HardBirch

react-native init cygwin 路径问题执行失败分析与解决

时间:15-10-17 栏目:iOS开发入门与提高, 安卓技术篇, 软件生活 作者:魔豆先生 评论:0 点击: 3,698 次

现象:

D:\Workspace>react-native init MythroadProject
This will walk you through creating a new React Native project in D:\Workspace\AwesomeProject
Installing react-native package from npm...

npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245: cygwin warning:
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245:   MS-DOS style path detected: C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git
-baa2986b/.git
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245:   Preferred POSIX equivalent is: /cygdrive/c/Users/SuperMan/AppData/Roaming/npm-cache/_git-remotes/git-github-com-facebo
ok-react-git-baa2986b/.git
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245:   CYGWIN environment variable option "nodosfilewarning" turns off this warning.
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245:   Consult the user's guide for more details about POSIX paths:
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245:     http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245: fatal: failed to open '/cygdrive/c/Users/SuperMan/AppData/Roaming/npm-cache/_git-remotes/git-github-com-facebook-react-g
it-baa2986b/C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b/objects': No such file or directory
npm ERR! git clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppData\Local\Temp\npm-11880-c7c0bc08\git-c
ache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Program Files\\nodejs\\\\node.exe" "D:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--save" "react-native"
npm ERR! node v0.12.7
npm ERR! npm  v2.11.3
npm ERR! code 128

npm ERR! Command failed: git -c core.longpaths=true clone C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b C:\Users\SuperMan\AppD
ata\Local\Temp\npm-11880-c7c0bc08\git-cache-7d0aa429ec15\b4e74e38e43ac53af8acd62c78c9213be0194245
npm ERR! cygwin warning:
npm ERR!   MS-DOS style path detected: C:\Users\SuperMan\AppData\Roaming\npm-cache\_git-remotes\git-github-com-facebook-react-git-baa2986b/.git
npm ERR!   Preferred POSIX equivalent is: /cygdrive/c/Users/SuperMan/AppData/Roaming/npm-cache/_git-remotes/git-github-com-facebook-react-git-baa2986b/.git
npm ERR!   CYGWIN environment variable option "nodosfilewarning" turns off this warning.
npm ERR!   Consult the user's guide for more details about POSIX paths:
npm ERR!     http://cygwin.com/cygwin-ug-net/using.html#using-pathnames
npm ERR! fatal: failed to open '/cygdrive/c/Users/SuperMan/AppData/Roaming/npm-cache/_git-remotes/git-github-com-facebook-react-git-baa2986b/C:\Users\SuperMan\AppData\Roaming\npm-c
ache\_git-remotes\git-github-com-facebook-react-git-baa2986b/objects': No such file or directory
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!     D:\Workspace\AwesomeProject\npm-debug.log

`npm install --save react-native` failed

分析:

如上面红色标记的,是安装了cygwin 的原因,普通的windows路径在cygwin下不认。

解决方案:

>echo %PATH%

>xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx;c:\cygwin\bin

重新设置PATH的值,去除其中的 cygwin路径

>PATH=xxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

重新执行命令,即可

react-native init MythroadProject

 

声明: 本文由( 魔豆先生 )原创编译,转载请保留链接: react-native init cygwin 路径问题执行失败分析与解决

react-native init cygwin 路径问题执行失败分析与解决:等您坐沙发呢!

发表评论


QQ群互动

Linux系统与内核学习群:194051772

WP建站技术学习交流群:194062106

魔豆之路QR

魔豆的Linux内核之路

魔豆的Linux内核之路

优秀工程师当看优秀书籍

优秀程序员,要看优秀书!

赞助商广告

友荐云推荐