Friday, 9 June 2017

npm install not working with --prefix

It seems that npm install --prefix ./server (with no args) is not working with --prefix flag. I just want to install all packages from package.json. All I get after that command is:

npm WARN enoent ENOENT: no such file or directory, open '/home/.../ProjectName/server/package.json'

All is fine when I put npm install package_name -S --prefix ./server for example. Then NPM will create node_modules in server and will add package_name package.

My files structure is:

ProjectName
|
+-- client
|   +-- node_modules
|   +-- package.json
+-- server
|   +-- node_modules
+-- package.json

"Main" package.json contains all scripts (for Heroku and for me) and dependiencies for server. client is Angular2 app that's why it has own node_modules and package.json.

I use NPM 4.2.0. With version 5.0.3 (newest?) it seems that --prefix flag is not working at all.



via tBlabs

No comments:

Post a Comment