nodejs tips
作为一个不常写前端的菜鸟,看到node在C盘留下及其离谱大小的缓存,加上电脑垃圾,所以要给默认的缓存换个目录:
【node_global】及【node_cache】
- npm config set prefix “D:\Develop\nodejs\node_global”
- npm config set cache “D:\Develop\nodejs\node_cache”
- 环境变量: 将【用户变量】下的【Path】修改为【D:\Develop\nodejs\node_global】 在【系统变量】下新建【NODE_PATH】,输入【D:\Develop\nodejs\node_global\node_modules】
安装淘宝镜像:
npm install -g cnpm –registry=https://registry.npm.taobao.org
设置默认镜像源:【二选一即可】
npm config set registry https://mirrors.huaweicloud.com/repository/npm/ 华为镜像 npm config set registry https://registry.npm.taobao.org 淘宝镜像 npm cache clean -f 清理缓存
Linux下可能遇到的问题及解决
sh: 1: node: Permission denied:
npm config set user 0 npm config set unsafe-perm true
未完待续…..
- Author: DY
- Link: http://4fan.top/posts/nodejs-tips/
- License: This work is under a 知识共享署名-非商业性使用-禁止演绎 4.0 国际许可协议. Kindly fulfill the requirements of the aforementioned License when adapting or creating a derivative of this work.