javascript - react-native init -> npm install -> gyp ERR!
怪我咯
怪我咯 2017-04-10 17:22:01
[JavaScript讨论组]

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
怪我咯
怪我咯

走同样的路,发现不同的人生

全部回复(2)
伊谢尔伦

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

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

巴扎黑

谁告诉你init后要进入初始化成功的目录,再执行npm install的?
init后,项目就已经初始化成功了,可以开发了!

热门教程
更多>
最新下载
更多>
网站特效
网站源码
网站素材
前端模板
关于我们 免责申明 意见反馈 讲师合作 广告合作 最新更新 English
php中文网:公益在线php培训,帮助PHP学习者快速成长!
关注服务号 技术交流群
PHP中文网订阅号
每天精选资源文章推送
PHP中文网APP
随时随地碎片化学习
PHP中文网抖音号
发现有趣的

Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号