0
votes

I am trying to create simple Phoenix application. When I run mix phoenix.new my_app I got an error that:

* running mix deps.get
* running npm install && node node_modules/brunch/bin/brunch build
* error command failed to execute, please run the following command again after installation: "npm install && node node_modules/brunch/bin/brunch build"

After the installation when I run the command in above,again I get an error:

npm ERR! install Couldn't read dependencies
npm ERR! package.json ENOENT: no such file or directory, open '/home/agil/package.json'
npm ERR! package.json This is most likely not a problem with npm itself.
npm ERR! package.json npm can't find a package.json file in your current directory.

npm ERR! System Linux 
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /home/userme
npm ERR! node -v v4.6.1
npm ERR! npm -v 1.4.21
npm ERR! path /home/userme/package.json
npm ERR! syscall open
npm ERR! code ENOPACKAGEJSON
npm ERR! errno -2
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/userme/npm-debug.log
npm ERR! not ok code 0

I don't know how to fix this. I have tried to run with --no-brunch options, but it didn't help to me. If you faced with problem like this I will be glad if you can share your experience.

1
Did you run the command inside the app directory? It seems that you're running npm on your $HOME insteadyorodm
No I tested that inside of my_app directory too. But didn't help.user7327263
Can you please edit your post and show that error message then? This one doesn't help us figure out the problem.yorodm
Sorry guys. I think I fixed that. I reinstalled everything. After reinstallation it seems no error more with --no-brunch options.Thank you for all reading and responding to my question.user7327263

1 Answers

0
votes

There are some other spots on S/O where this issue has come up. But the best spot to check before posting is likely in an issue on the project's GitHub page. This page provides an answer as to how to resolve the issue without needing to reinstall everything. You'll see after you encounter this error, you can still run your app; however, it warns that due to brunch being missing, the assets won't compile. In order to resolve this, you can manually create the assets folder, cd there, and then install brunch manually. So from your phoenix folder run:

mkdir assets
cd assets
npm install && node node_modules/brunch/bin/brunch build

Then when you run mix phoenix.server; you shouldn't encounter any errors and your assets will compile.