react-native init的问题,请大神帮忙解决一下,找过很多资料解决不了



  • This will walk you through creating a new React Native project in G:\cordova\A1
    'yarn' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
    ▒▒▒▒▒▒▒▒▒ļ▒▒▒
    Installing react-native...
    Consider installing yarn to make this faster: https://yarnpkg.com
    'npm' ▒▒▒▒▒ڲ▒▒▒▒ⲿ▒▒▒Ҳ▒▒▒ǿ▒▒▒▒еij▒▒▒
    ▒▒▒▒▒▒▒▒▒ļ▒▒▒
    { Error: Command failed: npm install --save --save-exact react-native
    at checkExecSyncError (child_process.js:472:13)
    at execSync (child_process.js:512:13)
    at run (C:\Users\PC1010\AppData\Roaming\npm\node_modules\react-native-cli\index.js:294:5)
    at createProject (C:\Users\PC1010\AppData\Roaming\npm\node_modules\react-native-cli\index.js:249:3)
    at init (C:\Users\PC1010\AppData\Roaming\npm\node_modules\react-native-cli\index.js:200:5)
    at Object.<anonymous> (C:\Users\PC1010\AppData\Roaming\npm\node_modules\react-native-cli\index.js:153:7)
    at Module.compile (module.js:570:32)
    at Object.Module.extensions..js (module.js:579:10)
    at Module.load (module.js:487:32)
    at tryModuleLoad (module.js:446:12)
    error: null,
    cmd: 'npm install --save --save-exact react-native',
    file: 'C:\Windows\system32\cmd.exe',
    args:
    [ 'C:\Windows\system32\cmd.exe',
    '/s',
    '/c',
    '"npm install --save --save-exact react-native"' ],
    options:
    { stdio: [ [Object], [Object], [Object] ],
    shell: true,
    windowsVerbatimArguments: true,
    file: 'C:\Windows\system32\cmd.exe',
    args:
    [ 'C:\Windows\system32\cmd.exe',
    '/s',
    '/c',
    '"npm install --save --save-exact react-native"' ],
    envPairs:
    [ 'ACLOCAL_PATH=C:\Program Files\Git\mingw64\share\aclocal;C:\Program Files\Git\usr\share\aclocal',
    'ALLUSERSPROFILE=C:\ProgramData',
    'ANDROID_HOME=C:\Users\PC1010\AppData\Local\Android\sdk',
    'APPDATA=C:\Users\PC1010\AppData\Roaming',
    'CLASSPATH=.;C:\Program Files\Java\jdk1.8.0_151\lib\dt.jar;C:\Program Files\Java\jdk1.8.0_151\lib\tools.jar',
    'COMMONPROGRAMFILES=C:\Program Files\Common Files',
    'COMPUTERNAME=DESKTOP-ODT9CSC',
    'COMSPEC=C:\Windows\system32\cmd.exe',
    'CONFIG_SITE=C:/Program Files/Git/mingw64/etc/config.site',
    'ChocolateyInstall=C:\ProgramData\chocolatey',
    'ChocolateyLastPathUpdate=周五 10月 27 18:53:57 2017',
    'CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files',
    'CommonProgramW6432=C:\Program Files\Common Files',
    'DISPLAY=needs-to-be-defined',
    'EXEPATH=C:\Program Files\Git',
    'HOME=C:\Users\PC1010',
    'HOMEDRIVE=C:',
    'HOMEPATH=\Users\PC1010',
    'HOSTNAME=DESKTOP-ODT9CSC',
    'INFOPATH=C:\Program Files\Git\usr\local\info;C:\Program Files\Git\usr\share\info;C:\Program Files\Git\usr\info;C:\Program Files\Git\share\info',
    'JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151',
    'LANG=zh_CN.UTF-8',
    'LOCALAPPDATA=C:\Users\PC1010\AppData\Local',
    'LOGONSERVER=\\DESKTOP-ODT9CSC',
    'MANPATH=C:\Program Files\Git\mingw64\share\man;C:\Program Files\Git\usr\local\man;C:\Program Files\Git\usr\share\man;C:\Program Files\Git\usr\man;C:\Program Files\Git\share\man',
    'MINGW_CHOST=x86_64-w64-mingw32',
    'MINGW_PACKAGE_PREFIX=mingw-w64-x86_64',
    'MINGW_PREFIX=C:/Program Files/Git/mingw64',
    'MSYSTEM=MINGW64',
    'MSYSTEM_CARCH=x86_64',
    'MSYSTEM_CHOST=x86_64-w64-mingw32',
    'MSYSTEM_PREFIX=C:/Program Files/Git/mingw64',
    'NUMBER_OF_PROCESSORS=4',
    'ORIGINAL_PATH=C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\PC1010\bin;C:\Program Files\Java\jdk1.8.0_151\bi;C:\Program Files\Java\jdk1.8.0_151\jre\bin";C:\Python27;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Python27;C:\ProgramData\chocolatey\bin;C:\Users\PC1010\AppData\Local\Android\sdk\tools;C:\Users\PC1010\AppData\Local\Android\sdk\platform-tools;C:\Users\PC1010\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\PC1010\AppData\Roaming\npm',
    'ORIGINAL_TEMP=C:/Users/PC1010/AppData/Local/Temp',
    'ORIGINAL_TMP=C:/Users/PC1010/AppData/Local/Temp',
    'OS=Windows_NT',
    'OneDrive=C:\Users\PC1010\OneDrive',
    'PATH=C:\Users\PC1010\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\PC1010\bin;C:\Program Files\Java\jdk1.8.0_151\bi;C:\Program Files\Java\jdk1.8.0_151\jre\bin";C:\Python27;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Python27;C:\ProgramData\chocolatey\bin;C:\Users\PC1010\AppData\Local\Android\sdk\tools;C:\Users\PC1010\AppData\Local\Android\sdk\platform-tools;C:\Users\PC1010\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\PC1010\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl',
    'PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
    'PKG_CONFIG_PATH=C:\Program Files\Git\mingw64\lib\pkgconfig;C:\Program Files\Git\mingw64\share\pkgconfig',
    'PLINK_PROTOCOL=ssh',
    'PROCESSOR_ARCHITECTURE=AMD64',
    'PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel',
    'PROCESSOR_LEVEL=6',
    'PROCESSOR_REVISION=3c03',
    'PROGRAMFILES=C:\Program Files',
    'PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules',
    'PUBLIC=C:\Users\Public',
    'PWD=G:/cordova',
    'ProgramData=C:\ProgramData',
    'ProgramFiles(x86)=C:\Program Files (x86)',
    'ProgramW6432=C:\Program Files',
    'SESSIONNAME=Console',
    'SHELL=C:\Program Files\Git\usr\bin\bash.exe',
    'SHLVL=2',
    'SSH_ASKPASS=C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass',
    'SYSTEMDRIVE=C:',
    'SYSTEMROOT=C:\Windows',
    'TEMP=C:\Users\PC1010\AppData\Local\Temp',
    'TERM=xterm',
    'TMP=C:\Users\PC1010\AppData\Local\Temp',
    'TMPDIR=C:\Users\PC1010\AppData\Local\Temp',
    'USERDOMAIN=DESKTOP-ODT9CSC',
    'USERDOMAIN_ROAMINGPROFILE=DESKTOP-ODT9CSC',
    'USERNAME=PC1010',
    'USERPROFILE=C:\Users\PC1010',
    'VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\',
    'WINDIR=C:\Windows',
    '
    =C:/Program Files/nodejs/node' ] },
    envPairs:
    [ 'ACLOCAL_PATH=C:\Program Files\Git\mingw64\share\aclocal;C:\Program Files\Git\usr\share\aclocal',
    'ALLUSERSPROFILE=C:\ProgramData',
    'ANDROID_HOME=C:\Users\PC1010\AppData\Local\Android\sdk',
    'APPDATA=C:\Users\PC1010\AppData\Roaming',
    'CLASSPATH=.;C:\Program Files\Java\jdk1.8.0_151\lib\dt.jar;C:\Program Files\Java\jdk1.8.0_151\lib\tools.jar',
    'COMMONPROGRAMFILES=C:\Program Files\Common Files',
    'COMPUTERNAME=DESKTOP-ODT9CSC',
    'COMSPEC=C:\Windows\system32\cmd.exe',
    'CONFIG_SITE=C:/Program Files/Git/mingw64/etc/config.site',
    'ChocolateyInstall=C:\ProgramData\chocolatey',
    'ChocolateyLastPathUpdate=周五 10月 27 18:53:57 2017',
    'CommonProgramFiles(x86)=C:\Program Files (x86)\Common Files',
    'CommonProgramW6432=C:\Program Files\Common Files',
    'DISPLAY=needs-to-be-defined',
    'EXEPATH=C:\Program Files\Git',
    'HOME=C:\Users\PC1010',
    'HOMEDRIVE=C:',
    'HOMEPATH=\Users\PC1010',
    'HOSTNAME=DESKTOP-ODT9CSC',
    'INFOPATH=C:\Program Files\Git\usr\local\info;C:\Program Files\Git\usr\share\info;C:\Program Files\Git\usr\info;C:\Program Files\Git\share\info',
    'JAVA_HOME=C:\Program Files\Java\jdk1.8.0_151',
    'LANG=zh_CN.UTF-8',
    'LOCALAPPDATA=C:\Users\PC1010\AppData\Local',
    'LOGONSERVER=\\DESKTOP-ODT9CSC',
    'MANPATH=C:\Program Files\Git\mingw64\share\man;C:\Program Files\Git\usr\local\man;C:\Program Files\Git\usr\share\man;C:\Program Files\Git\usr\man;C:\Program Files\Git\share\man',
    'MINGW_CHOST=x86_64-w64-mingw32',
    'MINGW_PACKAGE_PREFIX=mingw-w64-x86_64',
    'MINGW_PREFIX=C:/Program Files/Git/mingw64',
    'MSYSTEM=MINGW64',
    'MSYSTEM_CARCH=x86_64',
    'MSYSTEM_CHOST=x86_64-w64-mingw32',
    'MSYSTEM_PREFIX=C:/Program Files/Git/mingw64',
    'NUMBER_OF_PROCESSORS=4',
    'ORIGINAL_PATH=C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\PC1010\bin;C:\Program Files\Java\jdk1.8.0_151\bi;C:\Program Files\Java\jdk1.8.0_151\jre\bin";C:\Python27;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Python27;C:\ProgramData\chocolatey\bin;C:\Users\PC1010\AppData\Local\Android\sdk\tools;C:\Users\PC1010\AppData\Local\Android\sdk\platform-tools;C:\Users\PC1010\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\PC1010\AppData\Roaming\npm',
    'ORIGINAL_TEMP=C:/Users/PC1010/AppData/Local/Temp',
    'ORIGINAL_TMP=C:/Users/PC1010/AppData/Local/Temp',
    'OS=Windows_NT',
    'OneDrive=C:\Users\PC1010\OneDrive',
    'PATH=C:\Users\PC1010\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\PC1010\bin;C:\Program Files\Java\jdk1.8.0_151\bi;C:\Program Files\Java\jdk1.8.0_151\jre\bin";C:\Python27;C:\Python27\Scripts;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Program Files (x86)\Skype\Phone;C:\Program Files\nodejs;C:\Program Files\Git\cmd;C:\Python27;C:\ProgramData\chocolatey\bin;C:\Users\PC1010\AppData\Local\Android\sdk\tools;C:\Users\PC1010\AppData\Local\Android\sdk\platform-tools;C:\Users\PC1010\AppData\Local\Microsoft\WindowsApps;C:\Program Files\Microsoft VS Code\bin;C:\Users\PC1010\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl',
    'PATHEXT=.COM;.EXE;.BAT;.CMD;.VBS;.VBE;.JS;.JSE;.WSF;.WSH;.MSC',
    'PKG_CONFIG_PATH=C:\Program Files\Git\mingw64\lib\pkgconfig;C:\Program Files\Git\mingw64\share\pkgconfig',
    'PLINK_PROTOCOL=ssh',
    'PROCESSOR_ARCHITECTURE=AMD64',
    'PROCESSOR_IDENTIFIER=Intel64 Family 6 Model 60 Stepping 3, GenuineIntel',
    'PROCESSOR_LEVEL=6',
    'PROCESSOR_REVISION=3c03',
    'PROGRAMFILES=C:\Program Files',
    'PSModulePath=C:\Program Files\WindowsPowerShell\Modules;C:\Windows\system32\WindowsPowerShell\v1.0\Modules',
    'PUBLIC=C:\Users\Public',
    'PWD=G:/cordova',
    'ProgramData=C:\ProgramData',
    'ProgramFiles(x86)=C:\Program Files (x86)',
    'ProgramW6432=C:\Program Files',
    'SESSIONNAME=Console',
    'SHELL=C:\Program Files\Git\usr\bin\bash.exe',
    'SHLVL=2',
    'SSH_ASKPASS=C:/Program Files/Git/mingw64/libexec/git-core/git-gui--askpass',
    'SYSTEMDRIVE=C:',
    'SYSTEMROOT=C:\Windows',
    'TEMP=C:\Users\PC1010\AppData\Local\Temp',
    'TERM=xterm',
    'TMP=C:\Users\PC1010\AppData\Local\Temp',
    'TMPDIR=C:\Users\PC1010\AppData\Local\Temp',
    'USERDOMAIN=DESKTOP-ODT9CSC',
    'USERDOMAIN_ROAMINGPROFILE=DESKTOP-ODT9CSC',
    'USERNAME=PC1010',
    'USERPROFILE=C:\Users\PC1010',
    'VBOX_MSI_INSTALL_PATH=C:\Program Files\Oracle\VirtualBox\',
    'WINDIR=C:\Windows',
    '
    =C:/Program Files/nodejs/node' ],
    stderr: null,
    stdout: null,
    pid: 5384,
    output: [ null, null, null ],
    signal: null,
    status: 1 }
    Command npm install --save --save-exact react-native failed.



  • 看不到具体错误(乱码部分
    贴一下node版本看看



  • @晴明 好谢谢大神,
    node v6.11.4
    npm 5.5.1 参考一个解决方案是更新到最新,之前版本也是不行
    yarn 1.2.1

    我跑cordova项目能跑,就是RN init都不行



  • @晴明 问题已解决。重启电脑就好了。。也可能是用git bash导致失败,用回CMD就不会了


Log in to reply