javascript - react-native init -> npm install -> gyp ERR!

查看:147
本文介绍了javascript - react-native init -> npm install -> gyp ERR!的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

问 题

init react-native 项目之后,进入项目根目录并执行 npm install 报错, OIZ求解

我的操作步骤
1.react-native init xjjq
2.cd xjjq
3.npm install

环境:win10、node 5.7.1、react-native-cli 0.1.10、react-native 0.21.0

lsp@DESKTOP-5FBH8V5 D:\software\allworkspace\xjjq\node_modules\bufferutil
$ if not defined npm_config_node_gyp (node "D:\software\nvm\v5.7.1\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加/m开关。
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or Platform Toolset may be set to an invalid version number. [D:\software\allworkspace\xjjq\node_modules\bufferutil\build\bufferutil.vcxproj]
  TRACKER : 错误 TRK0005: 未能找到: CL.exe。系统找不到指定的文件。


C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(356,5): error MSB6006: CL.exe已退出,代码为 5。 [D:\software\allworkspace\xjjq\node_modules\bufferutil\build\buff
erutil.vc
xproj]
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 (D:\software\nvm\v5.7.1\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "D:\\software\\nodejs\\node.exe" "D:\\software\\nvm\\v5.7.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\software\allworkspace\xjjq\node_modules\bufferutil
gyp ERR! node -v v5.7.1
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
npm WARN install:bufferutil@1.2.1 bufferutil@1.2.1 install: `node-gyp rebuild`
npm WARN install:bufferutil@1.2.1 Exit status 1

> utf-8-validate@1.2.1 install D:\software\allworkspace\xjjq\node_modules\utf-8-validate
> node-gyp rebuild


lsp@DESKTOP-5FBH8V5 D:\software\allworkspace\xjjq\node_modules\utf-8-validate
$ if not defined npm_config_node_gyp (node "D:\software\nvm\v5.7.1\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
在此解决方案中一次生成一个项目。若要启用并行生成,请添加/m开关。
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppBuild.targets(366,5): warning MSB8003: Could not find WindowsSDKDir variable from the registry.  TargetFrameworkVersion or Platform Toolset may be set to an invalid version number. [D:\software\allworkspace\xjjq\node_modules\utf-8-validate\build\validation.vcxproj]
  TRACKER : 错误 TRK0005: 未能找到: CL.exe。系统找不到指定的文件。


C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Microsoft.CppCommon.targets(356,5): error MSB6006: CL.exe已退出,代码为 5。 [D:\software\allworkspace\xjjq\node_modules\utf-8-validate\build\
validatio
n.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 (D:\software\nvm\v5.7.1\node_modules\npm\node_modules\node-gyp\lib\build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:100:13)
gyp ERR! stack     at ChildProcess.emit (events.js:185:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Windows_NT 10.0.10586
gyp ERR! command "D:\\software\\nodejs\\node.exe" "D:\\software\\nvm\\v5.7.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\software\allworkspace\xjjq\node_modules\utf-8-validate
gyp ERR! node -v v5.7.1
gyp ERR! node-gyp -v v3.3.0
gyp ERR! not ok
npm WARN install:utf-8-validate@1.2.1 utf-8-validate@1.2.1 install: `node-gyp rebuild`
npm WARN install:utf-8-validate@1.2.1 Exit status 1
npm WARN optional Skipping failed optional dependency /chokidar/fsevents:
npm WARN notsup Not compatible with your operating system or architecture: fsevents@1.0.8

解决方案

先按照如下网站说明设置:
https://github.com/nodejs/node-gyp#installation

尝试了各种设置,最终在删除了杀毒软件的情况下,可以npm install了
(可能不需要删除,只需要停止即可)

这篇关于javascript - react-native init -> npm install -> gyp ERR!的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆