【问题标题】:Can't npm install react-native on Windows无法在 Windows 上安装 react-native
【发布时间】:2015-09-30 00:40:26
【问题描述】:

由于可以在 Windows 中开发 react-native 应用程序,只需进行少量手动调整,我想安装它。

我通过 CLI 成功地 gitclone 了 repo,但是当涉及到 npm install 时,控制台向我抛出了这个:

npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:203:12)
npm WARN addRemoteGit     at emitTwo (events.js:87:13)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:172:7)
npm WARN addRemoteGit     at maybeClose (internal/child_process.js:817:16)
npm WARN addRemoteGit     at Socket.<anonymous> (internal/child_process.js:319:11)
npm WARN addRemoteGit     at emitOne (events.js:77:13)
npm WARN addRemoteGit     at Socket.emit (events.js:169:7)
npm WARN addRemoteGit     at Pipe._onclose (net.js:469:12)
npm WARN addRemoteGit  git://github.com/facebook/react.git#b4e74e38e43ac53af8acd62c78c9213be0194245 resetting remote C:\
Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b because of error: { [Error:
 Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm ERR! git clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/
facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b: Clon
ing into bare repository 'C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986
b'...
npm ERR! git clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/
facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b: fata
l: unable to connect to github.com:
npm ERR! git clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/
facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b: gith
ub.com[0: 192.30.252.130]: errno=No error
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-
cli.js" "install"
npm ERR! node v4.1.1
npm ERR! npm  v2.14.4
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remote
s\_templates --mirror git://github.com/facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-githu
b-com-facebook-react-git-baa2986b
npm ERR! Cloning into bare repository 'C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-reac
t-git-baa2986b'...
npm ERR! fatal: unable to connect to github.com:
npm ERR! github.com[0: 192.30.252.130]: errno=No error
npm ERR!
npm ERR!
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\***\react-native\npm-debug.log

这就是 npm.debug.log 所拥有的:

3616 error git clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b: Cloning into bare repository 'C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b'...
3616 error git clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b: fatal: unable to connect to github.com:
3616 error git clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b: github.com[0: 192.30.252.130]: errno=No error
3617 verbose stack Error: Command failed: git -c core.longpaths=true clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b
3617 verbose stack Cloning into bare repository 'C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b'...
3617 verbose stack fatal: unable to connect to github.com:
3617 verbose stack github.com[0: 192.30.252.130]: errno=No error
3617 verbose stack
3617 verbose stack
3617 verbose stack     at ChildProcess.exithandler (child_process.js:203:12)
3617 verbose stack     at emitTwo (events.js:87:13)
3617 verbose stack     at ChildProcess.emit (events.js:172:7)
3617 verbose stack     at maybeClose (internal/child_process.js:817:16)
3617 verbose stack     at Socket.<anonymous> (internal/child_process.js:319:11)
3617 verbose stack     at emitOne (events.js:77:13)
3617 verbose stack     at Socket.emit (events.js:169:7)
3617 verbose stack     at Pipe._onclose (net.js:469:12)
3618 verbose cwd C:\Users\***\react-native
3619 error Windows_NT 6.1.7601
3620 error argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
3621 error node v4.1.1
3622 error npm  v2.14.4
3623 error code 128
3624 error Command failed: git -c core.longpaths=true clone --template=C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\_templates --mirror git://github.com/facebook/react.git C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b
3624 error Cloning into bare repository 'C:\Users\***\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b'...
3624 error fatal: unable to connect to github.com:
3624 error github.com[0: 192.30.252.130]: errno=No error
3625 error If you need help, you may report this error at:
3625 error     <https://github.com/npm/npm/issues>
3626 verbose exit [ 1, true ]

请注意,由于个人信息,我用 *** 隐藏了一些路径。

问题是我可以完美地连接到 Github,并对我的 repos 进行标准操作,我可以手动 git clone react-native repo。

我尝试了this,这似乎解决了我的问题,但没有成功。

【问题讨论】:

    标签: node.js windows git npm react-native


    【解决方案1】:

    由于我使用公司代理,因此出现了问题。我通过运行解决了它

    git config --global url."https://".insteadOf git://
    

    这会强制所有到 GitHub 的连接都通过 https。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2019-12-04
      • 1970-01-01
      • 1970-01-01
      • 2019-11-10
      • 1970-01-01
      • 1970-01-01
      • 2018-04-29
      • 1970-01-01
      相关资源
      最近更新 更多