Set directory for NPM

随声附和 提交于 2019-12-24 22:57:07

问题


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

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