npm - 我无法成功使用 install npm packages
问题描述
我正在尝试下载一些源代码并构建一个软件。README 文件说它需要使用 npm 工具。就像首先使用 npm install,然后 npm run build,然后 npm run dev。但是,当我尝试使用 npm install 时,我被卡住了。我无法成功安装 npm 包。
以下是一些错误信息:
C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection>if not defined npm_config_node_gyp (node "C:\Users\michael liu\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Users\michael liu\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
detection.cpp
deviceList.cpp
detection_win.cpp
win_delay_load_hook.cc
..\src\detection_win.cpp(5): fatal error C1083: Cannot open include file: 'atlstr.h': No such file or directory [C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\build\detection.vcxproj]
..\src\detection.cpp(60): warning C4996: 'Nan::Callback::Call': was declared deprecated [C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\build\detection.vcxproj]
C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\node_modules\nan\nan.h(1740): note: see declaration of 'Nan::Callback::Call'
..\src\detection.cpp(105): warning C4996: 'Nan::Callback::Call': was declared deprecated [C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\build\detection.vcxproj]
C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\node_modules\nan\nan.h(1740): note: see declaration of 'Nan::Callback::Call'
..\src\detection.cpp(195): warning C4996: 'Nan::Callback::Call': was declared deprecated [C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\build\detection.vcxproj]
C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection\node_modules\nan\nan.h(1740): note: see declaration of 'Nan::Callback::Call'
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:\Users\michael liu\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17134
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\michael liu\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\michael liu\Desktop\IBSMK\ibsmk\node_modules\usb-detection
gyp ERR! node -v v10.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN IBSMK@1.5.5 No repository field.
npm WARN IBSMK@1.5.5 No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! usb-detection@4.3.0 install: `prebuild-install || node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the usb-detection@4.3.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\michael liu\AppData\Roaming\npm-cache\_logs\2019-07-30T02_53_24_589Z-debug.log
解决方案
在 Node v10 和 Electron v3 的时候有很多问题,它没有向 node-abi 报告正确的 ABI 版本。解决方案似乎是“不要使用 Node v10”。
推荐阅读
- android - Android Room FOREIGN KEY约束失败代码787
- python - 无法解析石墨烯中带下划线的字段名称
- java - 在 prepareStatement 中使用 COALESCE 来“插入”cmd
- c# - 限制类实例化并将其封装在另一个类的属性中
- python - 在 Telethon 中查看已删除消息的文本或发件人
- django - 处理 django url 中的 html 特殊字符
- c# - 是否有读取整个控制台的功能?
- html - ul 元素在反应中没有定位在中心
- facebook - 如何使用 facebook 应用程序和 webhook 从多个 facebook 页面获取潜在客户?
- javascript - 通过使用 setInterval 动态改变值