package.json for global module installation

邮差的信 提交于 2019-12-10 17:13:42

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!