将Node.js安装在从C到D的不同硬盘上 [英] Install Node.js on a different hard drive from C to D

查看:204
本文介绍了将Node.js安装在从C到D的不同硬盘上的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有节点和npm,它们中的现有软件包当前已安装到Windows上的C驱动器中.我的C驱动器是一个空间很小的SSD.如何将节点安装移动到其他驱动器?我需要重新安装节点和所有软件包吗?当前的节点安装程序似乎未指定驱动器.

I have node and npm with existing packages currently installed to the C drive on Windows. My C drive is an SSD with a low amount of space. How can I move the node installation to a different drive? Would I need to reinstall node and all packages? The current node installer doesn't seem to specify drives.

推荐答案

您可以将node.exe移至d驱动器.然后检查您的环境路径.在命令窗口或计算机属性中键入设置.确保您的路径中包含包含node.exe的文件夹.这样,在命令窗口中运行节点将可以在任何文件夹中工作.

You can move the node.exe to the d drive. Then check your environment path. Type set in a command window or in computer properties. Make sure you have the folder that contains node.exe in your path. Running node in a command window will work from any folder then.

对于已安装的npm软件包,即node.modules文件夹.该目录只需要位于您编写代码的目录中,因此请尝试将该文件夹放入d:\假定您要在d上编写应用程序现在开车.

For installed npm packages, ie.. node_modules folder.. That just needs to be in a directory above where your writing your code, so try putting that folder in d:\ Assuming your going to be writing your apps on the d drive now.

在.npmrc文件中,将前缀设置更改为所需的文件夹.全局软件包将安装在该文件夹下的node_modules中

In .npmrc file, change prefix setting to desired folder. Global packages get installed in node_modules under that folder

这篇关于将Node.js安装在从C到D的不同硬盘上的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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