美文网首页ReactNative 学习
npm install -g react-native-cli

npm install -g react-native-cli

作者: 朝圣的路上 | 来源:发表于2016-05-10 14:09 被阅读1730次

    React native 配置安装请参考这里.

    前面比较顺利,当运行到这里的时候出现问题;

    $ npm install -g react-native-cli

    npm ERR! network This is most likely not a problem with npm itself
    npm ERR! network and is related to network connectivity.
    npm ERR! network In most cases you are behind a proxy or have bad network settings.
    npm ERR! network
    npm ERR! network If you are behind a proxy, please make sure that the
    npm ERR! network 'proxy' config is set properly. See: 'npm help config'
    npm ERR! Please include the following file with any support request:
    npm ERR! /Users/luke/react-native/npm-debug.log

    出现这个问题通常是因为registry配置有问题,这个可以在~/.npmrc里看到。可以通过以下三种方法解决:

    1. 删除npmrc文件,重新创建

    $vi ~/.npmrc
    registry = http://registry.cnpmjs.org

    1. 使用npm config命令配置

    $ npm config set registry http://registry.cnpmjs.org
    $npm info underscore

    1. 和方法2类似

    npm --registry http://registry.cnpmjs.org info underscore

    以上方法均可解决npm install 的网络问题。

    相关文章

      网友评论

        本文标题:npm install -g react-native-cli

        本文链接:https://www.haomeiwen.com/subject/xllyrttx.html