无法在 Windows 上 npm 安装 react-native
Can't npm install react-native on Windows
由于可以在 Windows 中开发 react-native 应用程序,只需进行一些小的手动调整,我就想安装它。
我通过 CLI 成功地 git 克隆了 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,并对我的存储库执行标准操作,我可以 git 手动克隆 react-native 存储库。
我尝试了 this,这似乎解决了我的问题,但没有成功。
问题发生是因为我使用的是公司代理。我通过 运行
解决了
git config --global url."https://".insteadOf git://
强制所有到 GitHub 的连接都通过 https。
由于可以在 Windows 中开发 react-native 应用程序,只需进行一些小的手动调整,我就想安装它。
我通过 CLI 成功地 git 克隆了 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,并对我的存储库执行标准操作,我可以 git 手动克隆 react-native 存储库。
我尝试了 this,这似乎解决了我的问题,但没有成功。
问题发生是因为我使用的是公司代理。我通过 运行
解决了git config --global url."https://".insteadOf git://
强制所有到 GitHub 的连接都通过 https。