travisf

travisf

`mix assets.deploy` fails due to ESBuild assets

I’m working with Phoenix 1.7 and Docker fails at the step RUN mix.assets.deploy when deploying to fly (mix assets.deploy) works locally.

0.973
0.973 14:51:47.026 [debug] Downloading esbuild from https://registry.npmjs.org/@esbuild/linux-x64/0.17.11
1.517 ✘ [ERROR] Could not resolve "@mapbox/search-js-web"
1.517
1.517     js/maps.js:1:33:
1.517       1 │ import { autofill, config } from '@mapbox/search-js-web'
1.517         ╵                                  ~~~~~~~~~~~~~~~~~~~~~~~
1.517
1.517   You can mark the path "@mapbox/search-js-web" as external to exclude it from the bundle, which will remove this error.
1.517
1.536 1 error
1.552 ** (Mix) `mix esbuild postbox --minify` exited with 1

I installed the package with npm install @mapbox/search-js-web --save it’s listed in 'assets/ package-lock.json. Then I'm importing it from assets/js/maps.jswith:import { autofill, config } from ‘@mapbox/search-js-web’` seems to be standard JS stuff. What am I missing?

Most Liked

100phlecs

100phlecs

The Dockerfile in the Phoenix docs doesn’t include using npm assets.

Here’s a thread which shows what you need to add:

Where Next?

Popular in Questions Top

rms.mrcs
Hi, I need to transform a list of numbers into a map where the keys are the indexes and the values are the original values of the list. ...
New
hariharasudhan94
Lets say I have map like this fetching from my database %{"_id" => #BSON.ObjectId<58eb1a7a9ad169198c3dXXXX>, "email" => ...
New
jononomo
For some reason my phoenix channels are working for me in my local dev environment, but as soon as I deploy via Docker, I get a 403 error...
New
gshaw
What is the idiomatic way of matching for not nil in Elixir? E.g., First way: defp halt_if_not_signed_in(conn, signed_in_account) when...
New
fireproofsocks
Forgive me if this is obvious, but how does one delete a database record WITHOUT selecting it first? Ecto.Repo — Ecto v3.14.0 has exampl...
New
WestKeys
Currently suffering from paralysis by [HTTP client] analysis. This is rather unusual in Elixirland as there tends to be consensus on the ...
New
Harrisonl
We have an ECS cluster with 4 services, where each task joins a single cluster, via discovery ECS discovery service. Currently when I de...
New

Other popular topics Top

Qqwy
Update: How to use the Blogs & Podcasts section You can post links to your blog posts or podcasts either in one of the Official Blog...
3271 130286 1222
New
stefanchrobot
What’s the safe way to decode a JSON string into a struct? I want to avoid calling String.to_atom. Jason.decode can give me a map with st...
New
shijith.k
I am trying to start a new phoenix project with elixir 1.9, but mix phx.new does not work. It says that ** (Mix) The task "phx.new" could...
New
AngeloChecked
What learn first? Rust or Elixir Hi Elixir community! I’m here because i want learn a new language. I’m a junior developer and mainly i ...
New
jason.o
In the code below, if the create action is not set to accept “extra_key” as an input, it errors out with a message shown above. Is there ...
New
AstonJ
Posting this to see if we can make things easier for people to get into Neovim. If you use Neovim and have a favourite distro please let ...
New

We're in Beta

About us Mission Statement