jejuro

jejuro

From today morning, I CAN’T generate a new Phoenix app, because it stops at command “npm install && node node_modules/webpack/bin/webpack.js --mode development” with error messages like below.

ERROR in ./js/app.js
Module build failed: Error: Package exports for ‘/Users/Jupeter/hello/assets/node_modules/@babel/helper-compilation-targets’ do not define a ‘.’ subpath …

or;

ERROR in ./js/app.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: Package exports for ‘/Users/Jupeter/hello/assets/node_modules/@babel/helper-compilation-targets’ do not define a ‘.’ subpath …

To solve this issue, I have spent a few hours including updating npm, webpack, and babel etc., but all efforts are in vain.

Any idea?
Thanks in advance.

PS> I asked it on stackoverflow with more details.

Showing Posts 11 to 20

jejuro

jejuro OP

Now another warning appears.

WARNING in configuration
The 'mode' option has not been set, webpack will fallback to 'production' for this value. Set 'mode' option to 'development' or 'production' to enable defaults for each environment.
mindok

mindok

That new warning looks like you didn’t copy in the full command-line (truncated at --mod rather than --mode development)

Can you test (maybe with some other framework) that your node / webpack infrastructure is behaving?

Do you have another machine that you can try?

Have you tried updating all your npm dependencies to the latest?

jejuro

jejuro OP

I am sure Phoenix will work on another machine as it has worked until today without problem.

I have updated all my npm dependencies. First, I removed the default “assets/node_modules”, and then, reinstall the dependencies like;
$ npm install --prefix assets

But, the issue continues. I will remove all the node.js related items, and reinstall them.

I am a refugee from JS spagetti eco-system, and have enjoyed the wonderful elixir+phoenix land for two months until now. But, the nodejs ghost still follows me…

jejuro

jejuro OP

This is the full error message.

ERROR in ./js/app.js
Module build failed: Error: Package exports for '/Users/Jupeter/islands_interface/assets/node_modules/@babel/helper-compilation-targets' do not define a '.' subpath
    at applyExports (internal/modules/cjs/loader.js:485:15)
    at resolveExports (internal/modules/cjs/loader.js:508:12)
    at Function.Module._findPath (internal/modules/cjs/loader.js:577:20)
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:879:27)
    at Function.Module._load (internal/modules/cjs/loader.js:785:27)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (/Users/Jupeter/islands_interface/assets/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/Users/Jupeter/islands_interface/assets/node_modules/@babel/preset-env/lib/debug.js:8:33)
    at Module._compile (/Users/Jupeter/islands_interface/assets/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
    at Module.load (internal/modules/cjs/loader.js:914:32)
    at Function.Module._load (internal/modules/cjs/loader.js:822:14)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (/Users/Jupeter/islands_interface/assets/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at Object.<anonymous> (/Users/Jupeter/islands_interface/assets/node_modules/@babel/preset-env/lib/index.js:11:14)
    at Module._compile (/Users/Jupeter/islands_interface/assets/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)
    at Module.load (internal/modules/cjs/loader.js:914:32)
    at Function.Module._load (internal/modules/cjs/loader.js:822:14)
    at Module.require (internal/modules/cjs/loader.js:956:19)
    at require (/Users/Jupeter/islands_interface/assets/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
    at requireModule (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/files/plugins.js:165:12)
    at loadPreset (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/files/plugins.js:83:17)
    at createDescriptor (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-descriptors.js:154:9)
    at /Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-descriptors.js:109:50
    at Array.map (<anonymous>)
    at createDescriptors (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-descriptors.js:109:29)
    at createPresetDescriptors (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-descriptors.js:101:10)
    at presets (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-descriptors.js:47:19)
    at mergeChainOpts (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-chain.js:320:26)
    at /Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-chain.js:283:7
    at Generator.next (<anonymous>)
    at buildRootChain (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/config-chain.js:120:29)
    at buildRootChain.next (<anonymous>)
    at loadPrivatePartialConfig (/Users/Jupeter/islands_interface/assets/node_modules/@babel/core/lib/config/partial.js:95:62)
    at loadPrivatePartialConfig.next (<anonymous>)
 @ multi ./js/app.js
jejuro

jejuro OP

I have removed all node related files from my computer, then reinstall nodejs.
Problem solved. :joy:

Does Phoenix LiveView also need webpack, babel and other nodejs modules? I hope another world without JS stubs.

Thank you all.
I have really enjoyed learning elixir, phoenix, and ecto for the last two months, and today was the hardest day due to the nodejs stubs such as webpack and babel.

dimitarvp

dimitarvp

I was about to say that it’s likely your Node installation is old.

As far as I am aware, no. LiveView is supposed to require very minimal JS that basically maintains the WebSockets connection and encode/decode data in transit.

wolfiton

wolfiton

@jejuro do you still want to learn how to use asdf?(I was away when you posted)

jejuro

jejuro OP

Yes, please. I have googled it, but couldn’t find helpful tutorials or guides. The official site is too simple for beginners.

Thanks everyone. I really appreciate it.

wolfiton

wolfiton

So i have Ubuntu as a system but you have Mac so you will probably use brew to install things.

Read the Important section a the end before starting following this guide

So let’s get started:

Head down here first:

Choose one of the two:

Using git(Recommended way)

git clone https://github.com/asdf-vm/asdf.git ~/.asdf
cd ~/.asdf
git checkout "$(git describe --abbrev=0 --tags)"

This is using brew

brew install asdf  - install asdf on Mac
brew install asdf --HEAD install asdf on Mac form the master repo with latest changes and fixes

Now if you use git do the following

Add to your Shell

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.bash_profile
echo -e '\n. $HOME/.asdf/completions/asdf.bash' >> ~/.bash_profile

I personally use zsh with antigen (you can read more here Kubuntu against my old Bodhi Linux)
For zsh

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zprofile

For brew install use this

Add to shell

echo -e "\n. $(brew --prefix asdf)/asdf.sh" >> ~/.bash_profile
echo -e "\n. $(brew --prefix asdf)/etc/bash_completion.d/asdf.bash" >> ~/.bash_profile

For zsh

Find asdf.sh and add to zsh

Following this command but locating the file

echo -e '\n. $HOME/.asdf/asdf.sh' >> ~/.zprofile

Now to be able to install plugins add the following deps via homebrew or spack
Brew

brew install \
  coreutils automake autoconf openssl \
  libyaml readline libxslt libtool unixodbc \
  unzip curl

Spack

spack install \
  coreutils automake autoconf openssl \
  libyaml readline libxslt libtool unixodbc \
  unzip curl

Verify that asdf is a known command to your shell by typing asdf

Now we are ready to add the plugins:

Here are all the plugins available: asdf

We will use the Erlang plugin the Elixir plugin

Erlang

So head down to: GitHub - asdf-vm/asdf-erlang: Erlang plugin for asdf version manager · GitHub

Before installing the Erlang plugin

OSX

These packages you have to install in order for the Erlang plugin to compile:

Install the build tools brew install autoconf

For building with wxWidgets (start observer or debugger!) brew install wxmac

Dealing with OpenSSL issues on macOS

You may encounter an SSL error with an output along these lines:

crypto : No usable OpenSSL found
ssh : No usable OpenSSL found
ssl : No usable OpenSSL found

This issue has been documented on kerl . If you see this error, you can use the --with-ssl flag with a path (in this case, the path is 1.0.2p , you should verify the correct path) before installing Erlang. Here is an example that skips the java depency and also sets a specific (and existing) path for OpenSSL on macOS.

$ export KERL_CONFIGURE_OPTIONS="--without-javac --with-ssl=/usr/local/Cellar/openssl/1.0.2p"
$ asdf install erlang <version>

Now we are ready for the actual install

So use the following command:

asdf install erlang ref:master

Give it time to compile, you can even go drink a coffee, because it will take some time to do this.

After it is done

Let’s get elixir:

head down here:

then use this command:

asdf plugin-add elixir https://github.com/asdf-vm/asdf-elixir.git

After elixir is installed you can install phoenix normally and it should all work

Here is the guide: Installation — Phoenix v1.8.8

  • So first install hex: mix local.hex if you already have it it will upgrade it to the latest version
  • Then mix archive.install hex phx_new 1.4.11 and yopu should be able now to use phoenix without worries.

!! Important

I wrote this guide without having access to a Mac OS so if there are any mistakes please correct them

I hope this will help you and others, that have issues with phoenix installation

wolfiton

wolfiton

Also I sent a request to the wonderful admins of the forums to verify if my guide is correct because i don’t have a Mac OS to test this.

So before following it wait for the OK from them.

Thanks for you patience

Where Next? Top

Trending in Questions Top

RSP87
I’m working on a project that simulates the bumbl example in the programming phoenix book. It acts almost like an email client. We have a...
New
kpanic
Hi everyone, I am toying with the idea of building a “match maker” for giving personal help to people that wants to start coding. I sta...
New
nseaSeb
Hello, I know there is an approach for handling lists that allows for optimized traversal, but I can’t recall the specific method (somet...
New
brecabral
Documentation While reading the Scoped Routes section, I noticed that the documentation currently refers to a problem without explainin...
New
velrest
So my question is quite simple and i have found no conclusive answer on forum, google or AI. Should we use :erlang.float for Integer to ...
New
asweet-confluent
I recently noticed that Elixir’s Logger defaults its primary log level to :debug when no :logger, :level application configuration is pre...
New
apz
I’m new to elixir and just tried to install the elixirLS extension for VScode(ium) and it is throwing some errors that I would like help ...
New

Other Trending Topics Top

GenericJam
Edit: 2026 May 15 - This post is archived. Mob is alive!! Main docs: mob v0.7.11 — Documentation A bit of explanation for the slightly c...
New
JesseHerrick
Hey, I’m Jesse and I’m the main contributor behind Dexter, a full-featured, lightning-fast Elixir LSP optimized for large codebases. It s...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
mhanberg
Hi everyone! The first release candidate for the Expert language server project is now available! We’ve published a press release detai...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews