我一直在尝试初始化一个新的react-native项目,并且总是遇到相同的ETIMEDOUT错误。
我在终端上运行“react-native init AwesomeProject --verbose”
这是我的npm-debug.log:https://gist.github.com/danielweinmann/a3a05ec4c253b9ff0016
我已经尝试将npm注册表设置为registry.npmjs.org,其中包含http和https.
我开始在Mountain Lion上测试然后升级到El Capitan并继续获得相同的结果
它似乎正确地安装了所有依赖项并且成功地将所有afterAdd写入package.json,但是在“即将构建”之后执行的“解锁”动词之后抛出错误。
这是终端屏幕的最后一部分:
npm verb afterAdd /Users/danielweinmann/.npm/uglify-js/2.4.24/package/package.json written
npm verb about to build /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm verb unlock done using /Users/danielweinmann/.npm/_locks/react-native-b39cdeb3f4f93e0a.lock for /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm verb stack Error: connect ETIMEDOUT 23.235.46.162:443
npm verb stack at Object.exports._errnoException (util.js:856:11)
npm verb stack at exports._exceptionWithHostPort (util.js:879:20)
npm verb stack at TCPConnectWrap.afterConnect [as oncomplete] (net.js:1062:14)
npm verb cwd /Users/danielweinmann/projects/AwesomeProject
npm ERR! Darwin 15.2.0
npm ERR! argv "/usr/local/Cellar/node/5.4.1/bin/node" "/usr/local/bin/npm" "install" "--verbose" "--save" "react-native"
npm ERR! node v5.4.1
npm ERR! npm v2.14.15
npm ERR! code ETIMEDOUT
npm ERR! errno ETIMEDOUT
npm ERR! syscall connect
npm ERR! network connect ETIMEDOUT 23.235.46.162:443
npm ERR! network This is most likely not a problem with npm itself
npm ERR! network and is related to network connectivity.
npm ERR! network In most cases you are behind a proxy or have bad network settings.
npm ERR! network
npm ERR! network If you are behind a proxy, please make sure that the
npm ERR! network 'proxy' config is set properly. See: 'npm help config'
npm verb exit [ 1, true ]
npm verb unbuild node_modules/react-native
npm info preuninstall react-native@0.18.0-rc
npm info uninstall react-native@0.18.0-rc
npm verb unbuild rmStuff react-native@0.18.0-rc from /Users/danielweinmann/projects/AwesomeProject/node_modules
npm verb gentlyRm vacuuming from /Users/danielweinmann/projects/AwesomeProject/node_modules/.bin/react-native up to /Users/danielweinmann/projects/AwesomeProject
npm info postuninstall react-native@0.18.0-rc
npm verb gentlyRm don't care about contents; nuking /Users/danielweinmann/projects/AwesomeProject/node_modules/react-native
npm ERR! Please include the following file with any support request:
npm ERR! /Users/danielweinmann/projects/AwesomeProject/npm-debug.log
`npm install --save react-native` failed
有谁知道发生了什么?任何人都可以帮助我吗?
非常感谢!
答案 0 :(得分:1)
最后,确实是一个网络问题。我通过wi-fi将我的手机的互联网连接路由到我的电脑来解决这个问题。
答案 1 :(得分:0)
在我的情况下,我必须在我的belkin路由器上禁用防火墙。与https://github.com/npm/npm/issues/8293无关的反应原生特定