我通过brew移除了节点安装,并按照React getting started page上的步骤安装iojs。在我通过brew更新npm之前。 React Native安装正确,但只要我尝试通过
启动应用程序react-native init my_app
我得到以下追踪:
gyp WARN install got an error, rolling back install
gyp ERR! configure error
gyp ERR! stack Error: 404 response dowloading http://nodejs.org/dist/v2.3.4/node-v2.3.4.tar.gz
gyp ERR! stack at Request.<anonymous> (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/install.js:251:14)
gyp ERR! stack at emitOne (events.js:82:20)
gyp ERR! stack at Request.emit (events.js:169:7)
gyp ERR! stack at Request.onRequestResponse (/usr/local/lib/node_modules/npm/node_modules/request/request.js:985:10)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! stack at ClientRequest.emit (events.js:169:7)
gyp ERR! stack at HTTPParser.parserOnIncomingClient (_http_client.js:415:21)
gyp ERR! stack at HTTPParser.parserOnHeadersComplete (_http_common.js:88:23)
gyp ERR! stack at Socket.socketOnData (_http_client.js:305:20)
gyp ERR! stack at emitOne (events.js:77:13)
gyp ERR! System Darwin 14.3.0
gyp ERR! command "/usr/local/Cellar/iojs/2.3.4/bin/iojs" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jason/projects/dos/node_modules/react-native/node_modules/babel/node_modules/chokidar/node_modules/fsevents
gyp ERR! node -v v2.3.4
gyp ERR! node-gyp -v v2.0.1
gyp ERR! not ok
重新安装node-gyp
无法解决问题。
我做错了什么?
答案 0 :(得分:0)
这是io.js和node-gyp的问题。在日志中查看此行:
Error: 404 response dowloading http://nodejs.org/dist/v2.3.4/node-v2.3.4.tar.gz
node-gyp尝试从node.js站点下载v2.3.4发行版,但它显然不存在,因为它是io.js.为了解决这个问题,io.js已经打补丁了。不幸的是,如果您通过npm install -g npm
更新npm,它将再次被破坏。
您可以尝试npm uninstall -g npm
但它似乎只是完全擦除npm,因此您必须重新安装io.js.