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

发布于 2022-09-02 09:56:33 字数 4168 浏览 15 评论 0

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

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

原野 2022-09-09 09:56:33

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

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

夏末 2022-09-09 09:56:33

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

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文