npm ERR! typeerror错误:缺少必需的参数#2

时间:2018-06-24 18:20:04

标签: node.js visual-studio-2017

当我尝试在Visual Studio 2017 Pro中通过package.json安装或更新节点软件包时,出现以下错误消息:

错误

PATH =。\ node_modules.bin; C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External;%PATH%; C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TeamFoundation \ Team Explorer \ Git \ cmd; C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Common7 \ IDE \ CommonExtensions \ Microsoft \ TeamFoundation \ Team Explorer \ Git \ mingw32 \ bin 安装“ C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ npm.CMD” npm ERR! Windows_NT 10.0.17134 npm ERR! argv“ C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ Node.exe”“ C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ bin \ npm-cli.js“”安装“ npm ERR!节点v5.4.1 npm ERR! npm v3.3.4 npm ERR!代码EMISSINGARG npm ERR! typeerror错误:缺少必需的参数#2 npm ERR! export.findRequirement(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ lib \ install \ deps.js:475:3)时出现typeerror npm ERR! C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ lib \ install \ deps.js:90:19处发生typeerror npm ERR! zalgoSafe处发生typeerror(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ dezalgo \ dezalgo.js:20:10) npm ERR!完成时出现typeerror(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ realize-package-specifier \ index.js:37:5) npm ERR! C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ realize-package-specifier \ index.js:22:20处发生typeerror npm ERR! FSReqWrap.oncomplete处发生typeerror(fs.js:82:15) npm ERR! typeerror这是npm本身的错误。请在以下位置报告此错误: npm ERR!类型错误http://github.com/npm/npm/issues npm ERR!请在任何支持请求中包括以下文件: npm ERR! C:\ Users \ Morten \ Documents \ GitHub \ MyProject \ src \ MyProject \ MyProject.Web \ npm-debug.log

npm-debug.log

0信息,如果以“ OK”结束则有效 1详细cli ['C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ Node.exe', 1个详细的cli'C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ bin \ npm-cli.js', 1详细cli'install'] 2信息使用npm@3.3.4 3信息使用node@v5.4.1 4愚蠢的loadCurrentTree开始 5愚蠢的安装loadCurrentTree 6傻装readLocalPackageData 7傻安装normalizeTree 8详细堆栈错误:缺少必需的参数#2 export.findRequirement(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ lib \ install \ deps.js:475:3)上的8个详细堆栈 C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ lib \ install \ deps.js:90:19处的8个详细堆栈 zalgoSafe上的8个详细堆栈(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ dezalgo \ dezalgo.js:20:10) 最终确定8个详细堆栈(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ realize-package-specifier \ index.js:37:5) C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ realize-package-specifier \ index.js:22:20处的8个详细堆栈 FSReqWrap.oncomplete上的8个详细堆栈(fs.js:82:15) 9详细的CWD C:\ Users \ Morten \ Documents \ GitHub \ MyProject \ src \ MyProject \ MyProject.Web 10错误Windows_NT 10.0.17134 11错误argv“ C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ Node.exe”“ C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ bin \ npm-cli.js“”安装“ 12个错误节点v5.4.1 13错误npm v3.3.4 14错误代码EMISSINGARG 15错误typeerror错误:缺少必需的参数#2 15出口时出现错误typeerror.findRequirement(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ lib \ install \ deps.js:475:3) C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ npm \ lib \ install \ deps.js:90:19处的15错误typeerror zalgoSafe处的15错误typeerror(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ dezalgo \ dezalgo.js:20:10) 最终完成时出现15个错误typeerror(C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ realize-package-specifier \ index.js:37:5) C:\ Program Files(x86)\ Microsoft Visual Studio \ 2017 \ Professional \ Web \ External \ node_modules \ realize-package-specifier \ index.js:22:20处的15错误typeerror FSReqWrap.oncomplete出现15个错误typeerror(fs.js:82:15) 15 error typeerror这是npm本身的错误。请在以下位置报告此错误: 15错误typeerror http://github.com/npm/npm/issues 16详细出口[1,true]

3 个答案:

答案 0 :(得分:2)

这是由于节点和npm版本过时造成的。

在Ubuntu / Debian系统中使用以下命令更新节点版本和npm版本

使用Ubuntu

curl -sL https://deb.nodesource.com/setup_10.x |须藤-E bash-

sudo apt-get install -y nodejs

使用Debian作为root用户

curl -sL https://deb.nodesource.com/setup_10.x |重击-

apt-get install -y nodejs

有关其他操作系统,请参阅Node installation/upgradation

答案 1 :(得分:0)

事实证明,在package.json文件中添加注释会导致问题。删除注释(见下文)后,软件包将更新并重新安装。

我有这个:   “ devDependencies”:{     “ gulp”:“ 3.9.1”,     “ //”:“ Gulp-sass 4需要节点6或更高版本,https://github.com/dlmanning/gulp-sass/issues/684”,     “ gulp-sass”:“ 3.2.1”,     “ gulp-cssmin”:“ 0.2.0”,     “ gulp-concat”:“ 2.6.1”,     ...

我更改为此   “ devDependencies”:{     “ gulp”:“ 3.9.1”,     “ gulp-sass”:“ 3.2.1”,     “ gulp-cssmin”:“ 0.2.0”,     “ gulp-concat”:“ 2.6.1”,     ...

另请参阅:GitHub问题:https://github.com/npm/npm/issues/19868

答案 2 :(得分:0)

np 4及更高版本支持

gulp-saas

使用npm install npm@latest更新NPM的版本即可解决问题