每个NPM模块都会导致错误

时间:2018-06-13 12:05:26

标签: node.js npm

每次在任何项目中我都会尝试安装新的NPM模块,并以错误结束。 有没有办法如何完全禁用node-gyp并通过节点执行所有操作?

C:\Users\Dan\Documents\react\fetchingInReact-master\node_modules\ursa>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:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.Cpp.Platform.targets(55,5): error MSB8020: The build tools for Visual Studio 2010 (Platform Toolset = 'v100') cannot be found. To build using the v
100 build tools, please install Visual Studio 2010 build tools.  Alternatively, you may upgrade to the current Visual Studio tools by selecting the Project menu or right-click the solution, and then selecting "Re
target solution". [C:\Users\Dan\Documents\react\fetchingInReact-master\node_modules\ursa\build\ursaNative.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:258:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:235:12)
gyp ERR! System Windows_NT 6.3.9600
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\Dan\Documents\react\fetchingInReact-master\node_modules\ursa
gyp ERR! node -v v10.1.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok

2 个答案:

答案 0 :(得分:0)

您需要安装MS visual c ++构建工具。你可以在命令

下面安装它
npm install --global --production windows-build-tools

此外,您可以找到可执行文件here

答案 1 :(得分:0)

好的,最后我已经解决了!

  1. 我卸载了NodeJS
  2. 从C:\ Program Files \ nodejs
  3. 删除了文件夹
  4. 安装NodeJS