设置NPM目录 [英] Set directory for NPM

查看:74
本文介绍了设置NPM目录的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在win 7上使用git-bash。我想开发一个ember项目,并且正在使用拇指驱动器。我已经在E驱动器上安装了节点,并将路径添加到环境变量。

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

因此我认为npm正在将软件包安装在c驱动器上。我需要在e驱动器上设置一个文件夹以使其可移植。我该怎么做?

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?

推荐答案

您可以通过配置npm 前缀设置进行设置:

You can set this by configuring the npm prefix setting:

npm config set prefix e:\some\path\on\e

可以通过修改项目的 .npmrc 文件在全局或每个项目上进行。

This could be done globally or on a per-project basis by modifying the project's .npmrc file.

使用 package.json 转到文件夹,然后运行 npm config ls 来查看您的有效npm配置。

Go to the folder with your package.json and run npm config ls to see your effective npm config.

请参见用于全局设置的npm文档

这篇关于设置NPM目录的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆