美文网首页
nrm安装完成 运行时 path环境 报错

nrm安装完成 运行时 path环境 报错

作者: 安北分享 | 来源:发表于2021-09-07 15:00 被阅读0次

错误内容:

node:internal/validators:119
    throw new ERR_INVALID_ARG_TYPE(name, 'string', value);
    ^

[TypeError: The "path" argument must be of type string. Received undefined
  at new NodeError (node:internal/errors:371:5)
  at validateString (node:internal/validators:119:11)
  at Object.join (node:path:429:7)
  at Object.<anonymous> (C:\Users\电脑名\AppData\Roaming\npm\node_modules\nrm\cli.js:17:20)
  at Module._compile (node:internal/modules/cjs/loader:1101:14)
  at Object.Module._extensions..js (node:internal/modules/cjs/loader:1153:10)
  at Module.load (node:internal/modules/cjs/loader:981:32)
  at Function.Module._load (node:internal/modules/cjs/loader:822:12)
  at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:79:12)
  at node:internal/main/run_main_module:17:47
] {
  code: 'ERR_INVALID_ARG_TYPE'
}

解决方法如下:目录参考:C:\Users\电脑名\AppData\Roaming\npm\node_modules\nrm\cli.js
找到并打开cli.js 第17行修改成

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

相关文章

网友评论

      本文标题:nrm安装完成 运行时 path环境 报错

      本文链接:https://www.haomeiwen.com/subject/jqqpwltx.html