Install a package globally in git bash, for example npm install -g gulp
, and it can be installed successfully.
But when using gulp --help
an error occurs:
`Error: Cannot find module 'C:\Program Files\Git\node_modules\gulp\bin\gulp.js'`
Other globally installed packages also encountered similar problems. The current temporary solution: is to copy the node_modules folder in the user directory of the C drive to the git installation directory.
But it is normal to use it in cmd, and the environment variables are also set. What is the reason? Is there a one-time solution?
漂亮男人2017-05-02 09:51:37
Try to modify the default installation directory of npm package
npm config set prefix xxxxx