React Native项目初始化错误(windows)

时间:2016-07-07 11:26:56

标签: node.js reactjs npm react-native

尝试执行react-native init AwesomeProject,但我遇到了令人沮丧的错误:

> utf-8-validate@1.2.1 install C:\Users\Yuval\AwesomeProject\node_modules\utf-8-validate
> node-gyp rebuild

C:\Users\**myName**\AwesomeProject\node_modules\utf-8-validate>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" 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\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error
         MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK vers
        ion in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:\Users\**myName**\
AwesomeProject\node_modules\utf-8-validate\build\validation.vcxproj]

我已安装: Visual C ++ Build工具2015 Node.js - 6.2.2 Python 2.7 node-gyp 3.3.1

真的很感谢你的帮助!

2 个答案:

答案 0 :(得分:2)

好的,感谢用户“Ramhound”问题解决了。 我做了什么:

  1. 重新安装visual c ++ build tools 2015,同时使用here

  2. 中的链接修复缺少的部分
  3. 在环境变量“PATH”变量中指出MSBuild.exe位置。

  4. 使用npm -g install npm@next
  5. 将node.js和node-gyp更新为最新版本

答案 1 :(得分:0)

运行:

npm cache clean

还要验证python必须在你的路径变量中。