问题一
不知道是不是前几天杀毒的原因,rn 突然跑不起来了报错如下:
MSBUILD : error MSB3428: Could not load the Visual C++ component "VCBuild.exe".
To fix this, 1) install the .NET Framework 2.0 SDK, 2) install Microsoft Visua
l Studio 2005 or 3) add the location of the component to the system path if it
is installed elsewhere. [E:\GitHub\jquery-mobile\node_modules\jquery\node_modu
les\contextify\build\binding.sln]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe
` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (D:\nodejs\node_modules\npm\node_modul
es\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:
12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "D:\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\
bin\\node-gyp.js" "rebuild"
gyp ERR! cwd E:\GitHub\jquery-mobile\node_modules\jquery\node_modules\contextify
gyp ERR! node -v v0.10.15
我在网上找了一段时间看报错也说是 没有装 Visual Studio 2005 啥的,我看了下我是装好了的,c++ 编译器也装了。终于让我找到了解决办法:
https://github.com/nodejs/node-gyp/issues/307
npm install --global --production windows-build-tools
就是这句。
https://www.npmjs.com/package/windows-build-tools
问题二
安装 react-native-network-info 失败
解决方案来自 https://github.com/pusherman/react-native-network-info/issues/52
在中国大陆我们需要修改 node_modules/react-native-network-info/android/build.gradle 这个目录下将
repositories {
jcenter()
google()
}
替换成
repositories {
jcenter()
maven{url 'http://maven.aliyun.com/nexus/service/local/repositories/google/content/'}
}
但是我替换了不仅要替换 google(),jcenter() 的资源我也拿到不到,后来我就干脆把这里全换成了 maven { url "http://maven.aliyun.com/nexus/content/groups/public" }
终于成功了。