问题描述
在我的 Windows 安装中 PATH
包括 C:Program Filesodejs
,其中可执行 node.exe
是.我可以从 shell 和 npm
启动 node
.我也希望在 C:Program Filesodejs
中安装新的可执行文件,但似乎无法实现.
设置 NODE_PATH
和 NODE_MODULES
变量不会改变任何东西:默认情况下,东西仍然安装在 %appdata%pm
中.>
如何更改全局安装路径?
您需要的一切都在 npm 文件夹
文档.我现在不想启动我的 Win 笔记本,所以我无法验证它,但你应该只在你的配置文件中将 prefix
更改为 C:Program Filesodejs
.如果要为所有用户全局更改它,请编辑 C:Program Filesodejspmrc
文件,否则创建/编辑 C:Users{username}.npmrc代码>.
但是这个改动可能会有一些副作用,所以请阅读这个讨论 首先.我认为这不是个好主意.
In my windows installation PATH
includes C:Program Filesodejs
, where executable node.exe
is. I'm able to launch node
from the shell, as well as npm
. I'd like new executables to be installed in C:Program Filesodejs
as well, but it seems impossible to achieve.
Setting NODE_PATH
and NODE_MODULES
variables doesn't change anything: things are still installed in %appdata%pm
by default.
How can I change the global installation path?
Everything you need is in the npm-folders
documentation. I don't want to start my Win notebook now so I cannot verify it, but you should only change prefix
to C:Program Filesodejs
in your config file. If you want to change it globally for all users, edit the C:Program Filesodejspmrc
file, otherwise create/edit C:Users{username}.npmrc
.
But this change will probably have some side effects, so read this discussion first. I don't think it's a good idea.
这篇关于更改 Windows 中 node.js 模块的默认全局安装目录?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!