问题
I'm working with git-bash on win 7. I want to develop an ember project and I am working on a thumb drive. I have installed node on my E drive and added the path to the env vars.
$ npm install -g ember-cli
C:\Users\me\AppData\Roaming\npm\ember -> C:\Users\me\AppData\Roaming\npm\node_modules\ember-cli\bin\ember
C:\Users\me\AppData\Roaming\npm\� -> C:\Users\me\AppData\Roaming\npm\node_modules\ember-cli\bin\ember
+ ember-cli@2.16.2
updated 553 packages in 89.25s
$ which npm
/e/nodejs/npm
$ which node
/e/nodejs/node
$ ember build
sh.exe": ember: command not found
So I think whats happening is that npm is installing the packages on the c drive. I need to set a folder on my e drive, to make this portable. How can I do this?
回答1:
You can set this by configuring the npm prefix
setting:
npm config set prefix e:\some\path\on\e
This could be done globally or on a per-project basis by modifying the project's .npmrc
file.
Go to the folder with your package.json
and run npm config ls
to see your effective npm config.
See the npm docs for global settings
来源:https://stackoverflow.com/questions/46919414/set-directory-for-npm