Package.json add "npm install -g" to preinstall

When writing package.json :

"scripts": { "preinstall": "npm install -g grunt-cli" }, "devDependencies": { "async": "^0.9.0", "grunt": "^0.4.5", "grunt-contrib-connect": "^0.9.0", "grunt-contrib-cssmin": "^0.10.0", "grunt-contrib-jshint": "^0.10.0", "grunt-contrib-uglify": "^0.6.0", "grunt-contrib-watch": "^0.6.1", "jit-grunt": "^0.9.0", "marked": "^0.3.2", "time-grunt": "^1.0.0", "underscore": "^1.7.0" }

And then run npm install command

It works on some computers, but on some I get this error: http://pastebin.com/rYUwhV5k

Is package.json used correctly? Is there any other way to do this? How to fix a problem that occurs on other computers?

+5
source share
1 answer

According to npm documentation "NOTE: INSTALLING SCRIPTS - ANTI-PATTERN" https://docs.npmjs.com/misc/scripts

In your case, it might be best to add to readme.md that you need to install grunt to run the tests (and let the user decide how to install it)

+2
source

Source: https://habr.com/ru/post/1209775/


All Articles