node.js - 无法使用 npm 安装 asyncawait

标签 node.js visual-studio npm

我尝试过运行

npm install asyncawait --save

在我的项目中,它首先失败了,我需要安装 python ,现在它输出以下错误:

D:\Projects\Lounge\Lounge>npm install asyncawait --save

> fibers@1.0.7 install D:\Projects\Lounge\Lounge\node_modules\fibers
> node build.js || nodejs build.js


D:\Projects\Lounge\Lounge\node_modules\fibers>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild --release )  else (node  rebuild --release )

Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.

C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not fi
nd WindowsSDKDir variable from the registry.  TargetFrameworkVersion or PlatformToolset may be set to an invalid versio
n number. 

[D:\Projects\Lounge\Lounge\node_modules\fibers\build\fibers.vcxproj]
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [D:\Projects\Lounge\Lou
nge\node_modules\fibers\build\fibers.vcxproj]


gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:270:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10240
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--release"
gyp ERR! cwd D:\Projects\Lounge\Lounge\node_modules\fibers
gyp ERR! node -v v4.1.0
gyp ERR! node-gyp -v v3.0.3
gyp ERR! not ok
Build failed
'nodejs' is not recognized as an internal or external command,
operable program or batch file.
Lounge@0.0.0 D:\Projects\Lounge\Lounge
└── (empty)

npm WARN EPACKAGEJSON Lounge@0.0.0 No repository field.
npm WARN EPACKAGEJSON Lounge@0.0.0 No license field.
npm ERR! Windows_NT 10.0.10240
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "asyncawait" "--save"
npm ERR! node v4.1.0
npm ERR! npm  v3.3.4
npm ERR! code ELIFECYCLE

npm ERR! fibers@1.0.7 install: `node build.js || nodejs build.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the fibers@1.0.7 install script 'node build.js || nodejs build.js'.
npm ERR! This is most likely a problem with the fibers package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node build.js || nodejs build.js
npm ERR! You can get their info via:
npm ERR!     npm owner ls fibers
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     D:\Projects\Lounge\Lounge\npm-debug.log
npm ERR! code 1

我使用 Visual Studios 2015 ,有 C++ 编译器(2010-2015 64 位和 32 位) Node 4.1.0。

最佳答案

我正在运行几乎相同的堆栈,当我遇到错误时,使用 npm-windows-upgrade 更新 NPM一切都解决了(请注意,作者是 Microsoft 员工)。

PowerShell 提示符的基本用法:

Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force

然后

npm install -g npm-windows-upgrade
npm-windows-upgrade

关于node.js - 无法使用 npm 安装 asyncawait,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/32949554/

相关文章:

javascript - 无法从github安装yarn包

node.js - 使用 NVM 时找不到 NPM

json - Darkcoin nomp 矿池支付处理错误且缺少 ui

node.js - 防止 "Unhandled promise rejection"错误

c++ - 我怎样才能找到这个令人难以置信的神秘链接器错误的原因?

javascript - 如何修复 'npm ERR! Cannot read property ' startsWith' of null'

node.js - 如何将 id 传递给路由器删除方法?

.net - 如何实现接口(interface)的默认方法?

c# - xamarin 与 Microsoft.EntityFrameworkCore.Sqlite 冲突

macos - 安装了触发器应用程序,安装了node.js,触发器说它无法在Mac上运行npm