我该如何修复Windows 10中的npm build错误?

时间:2019-02-27 03:45:42

标签: javascript node.js npm

我尝试了所有操作,但甚至无法安装一个npm模块。

我该如何解决?

Microsoft Windows [Version 10.0.17134.590]
(c) 2018 Microsoft Corporation. All rights reserved.
C:\Users\Dell\Desktop\npmtestfolder>npm install bootstrap
  

ed25519@0.0.4安装C:\ Users \ Dell \ node_modules \ ed25519   node-gyp重建

C:\Users\Dell\node_modules\ed25519>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\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.
C:\Users\Dell\node_modules\ed25519\build\ed25519.vcxproj(20,3): error MSB4019: The imported project "C:\Microsoft.Cpp.D
efault.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on
disk.
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:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
gyp ERR! System Windows_NT 10.0.17134
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"
gyp ERR! cwd C:\Users\Dell\node_modules\ed25519
gyp ERR! node -v v10.15.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open 'C:\Users\Dell\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\Dell\package.json'
npm WARN bootstrap@4.3.1 requires a peer of jquery@1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap@4.3.1 requires a peer of popper.js@^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN Dell No description
npm WARN Dell No repository field.
npm WARN Dell No README data
npm WARN Dell No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ed25519@0.0.4 (node_modules\ed25519):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: ed25519@0.0.4 install: `node-gyp rebuild`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

+ bootstrap@4.3.1
updated 1 package and audited 5449 packages in 13.153s
found 0 vulnerabilities

1 个答案:

答案 0 :(得分:2)

上述错误的原因很多。就像您的系统一样,没有正确的buildsystem路径。

您的项目名称也很重要。

您的CMD权利也很重要,例如[{Run as an Administrator]。

您是否已使用npm init初始化了您的项目?还记录到找不到package.json。您正在Windows根用户目录(这里是npm)上安装Dell库。不要那样做

创建一个单独的目录,并使用cd通过CMD dir Administrator。用npm init初始化目录。然后尝试使用(即npm i bootstrap)安装各自的库。

这可能会对您有所帮助。如果没有,这是最佳做法。在Node上工作时,您应该遵循。

相关问题