问题
I have a package.json in which some modules have to be installed globally,below is the part that i added below dependencies
"scripts": {
"preinstall": "npm i -g supervisor",
"preinstall": "npm i -g forever"
}
But when i ran npm install i got the error as below
npm WARN package.json aaa@0.0.0 No README.md file found!
npm WARN cannot run in wd aaa@0.0.0 npm i -g forever (wd=/home/administrator/AAA)
All the modules to be installed locally are getting installed,but only gloal installation is throwing an error.I am stuck here any help will be much appreciated.
回答1:
Put this in your package.json :
"config":{
"unsafe-perm":true
}
And install your module as root
.
Also I think that the switch preferGlobal
: Documentation, is created for modules that prefer to be installed globally. You might want to change your program logic to use programatically forever
module.
回答2:
Install your modules locally and then execute them via the bin folder in the local node_modules
directory
npm install -S forever
ls node_modules/.bin/
To start your app execute
node_modules/.bin/forever start app.js
来源:https://stackoverflow.com/questions/16393752/package-json-for-global-module-installation