7

修改NPM默认地址

 3 years ago
source link: https://ii74.com/post/6433.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

修改NPM默认地址

哎哎4年前 (2017-12-05)知乎精选177

默认安装完node.js后会自己安装npm,通过npm下载全局模块默认安装到C:\Users\wangyc\AppData\Roaming目录下,

主要有两个文件夹:

npm、npm-cache

npm:下载的具体模块 

npm-cache:npm的缓存文件 

 如果需要修改此两个文件的目录,甚至将将这两个文件拷贝到无法连网的机器上呢? 

使用命令: npm config set prefix "D:\nodejs\npm" npm config set cache "D:\nodejs\npm-cache" 

由于node全局模块大多数都是提供命令行访问的,所以还要把 D:\nodejs\npm 加到系统PATH里面,

注意同时需要将以前的默认路径从PATH中删除。


Recommend

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK