nrm报错

报错

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
internal/validators.js:112
throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
^

[TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received type undefined
at validateString (internal/validators.js:112:11)
at Object.join (path.js:375:7)
at Object.<anonymous> (C:\Users\wy\AppData\Roaming\npm\node_modules\nrm\cli.js:17:20)
at Module._compile (internal/modules/cjs/loader.js:955:30)
at Module.load (internal/modules/cjs/loader.js:811:32)
at Function.Module._load (internal/modules/cjs/loader.js:723:14)
at Function.Module.runMain (internal/modules/cjs/loader.js:1043:10)
at internal/main/run_main_module.js:17:11
] {
code: 'ERR_INVALID_ARG_TYPE'
}

解决

找到nrm安装位置,打开cli.js修改第17行

windows下目录在C:\Users\用户名\AppData\Roaming\npm\node_modules\nrm\

1
2
//const NRMRC = path.join(process.env.HOME, '.nrmrc'); (删除)
const NRMRC = path.join(process.env[(process.platform == 'win32') ? 'USERPROFILE' : 'HOME'], '.nrmrc');

更新项目里的npm依赖

背景

更新项目里的依赖项,传统的做法是一个一个更新,这种方式比较耗时,可以使用npm-check来更好的管理更新依赖项

阅读更多

NPM切换至淘宝源

全局配置切换到淘宝源

1
npm config set registry https://registry.npm.taobao.org

全局配置切换到官方源

1
npm config set registry http://www.npmjs.org

检测是否切换到淘宝源

1
npm config get registry