`phoenix` + `phoenix_html` NPM error for umbrella project

I have an umbrella project. But, having converted it to this, npm i commands no longer are working. I get the error:

npm WARN checkPermissions Missing write access to
 /Users/amarkskatz/Desktop/Projects/Elixir/functional_design/islands/apps/islands_interface/assets
/node_modules/phoenix
npm WARN checkPermissions Missing write access to
 /Users/amarkskatz/Desktop/Projects/Elixir/functional_design/islands/apps/islands_interface/assets
/node_modules/phoenix_html
npm WARN assets No description

npm ERR! path /Users/amarkskatz/Desktop/Projects/
Elixir/functional_design/islands/apps/islands_interface/assets/node_modules/phoenix
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, 
access '/Users/amarkskatz/Desktop/Projects/Elixir/functional_design/islands/apps/islands_interface/assets/node_modules/phoenix'
npm ERR! enoent This is related to npm not being
able to find a file.

Snippet from my package.json:

"phoenix": "file:../../../deps/phoenix",
"phoenix_html": "file:../../../deps/phoenix_html",

Strangely, deleting my node_modules folder then running npm i fixes my issue.

I’m guessing the phoenix and phoenix_html files linked to my pre-umbrella deps folder (only one ../ away).

So I’m guessing by running mix deps.get at the root level, then npm i in the child project’s assets folder (with updated file: paths in package.json), the new links generated point to the proper (new) directory location.

It couldn’t write to that directory, that’s not so much an npm error as it is that your OS is disallowing access to that location.

I had the same issue just now. And while it was indeed a filesystem issue, the issue was not created by me.

What I did to solve it was, from the root of your umbrella:

cd apps/myapp_web/assets/
npm install 
cd assets
rm -f phoenix phoenix_html
ln -s ../../../../deps/phoenix_html . 
ln -s ../../../../deps/phoenix . 
npm install 

That did the trick for me.

I.e., recreate the symlinks myself.

3 Likes