• React-native 加载新项目的时候出错


    sudo react-native init FirstApp

     使用react-native加载新的项目的时候报错了!!!!

    npm WARN react-native@0.43.2 requires a peer of react@16.0.0-alpha.6 but none was installed.

    npm WARN You are using a pre-release version of node and things may not work as expected

    You are currently running Node v8.0.0-pre but React Native requires >=4. Please use a supported version of Node.

    See https://facebook.github.io/react-native/docs/getting-started.html

     ┌────────────────────────────────────────────────────────────────────────────┐ 

     │  You are currently running io.js v8.0.0-pre.                               │ 

     │                                                                            │ 

     │  React Native runs on Node 4.0 or newer. There are several ways to         │ 

     │  upgrade Node.js depending on your preference.                             │ 

     │                                                                            │ 

     │  nvm:       nvm install node && nvm alias default node                     │ 

     │  Homebrew:  brew unlink iojs; brew install node                            │ 

     │  Installer: download the Mac .pkg from https://nodejs.org/                 │ 

     │                                                                            │ 

     │  About Node.js:   https://nodejs.org                                       │ 

     │  Follow along at: https://github.com/facebook/react-native/issues/2545   

    原因是我的mac在没有安装react-native之前已经下载了一个v8.0.0.0 pre 版本的node.js。

    现在看来应该node的版本和react-native的版本不兼容。

    所以,我决定安装它的要求安装一个 4.0 版本以上的node.js给它。

    然后我用HomeBrew的管理器下载node(HomeBrew相关使用请百度)

    brew install node    

    当它成功下载完了后,发出了以下的错误:

    这张图的意思就是说 现在下载的node版本 软连接到 当前版本的node失败了。但是它给出了如果将下载的版本软连接到当前版本。

    rm /usr/local/bin/node  // 移除当前版本的node

    注意:如果有权限限制问题,就在命令行前面加上 sudo

    sudo brew link --overwrite node
    brew link --overwrite --dry-run node

    然后在命令行输入:node 进行测试!完成!

  • 相关阅读:
    Pytorch学习笔记14----torch中相关函数使用:view函数、max()函数、squeeze()函数
    Pytorch学习笔记13----LSTM+CRF模型的CRF层原理与代码理解
    Pytorch学习笔记12----损失函数nn.CrossEntropyLoss()、nn.NLLLoss()
    Pytorch学习笔记12---- Pytorch的LSTM的理解及入门小案例
    Pytorch学习笔记11----model.train()与model.eval()的用法、Dropout原理、relu,sigmiod,tanh激活函数、nn.Linear浅析、输出整个tensor的方法
    Pytorch学习笔记10----LSTM循环神经网络原理
    webpack入门
    js判断对象是否为空对象的几种方法
    js的防抖和节流
    简述http协议
  • 原文地址:https://www.cnblogs.com/tjc1996/p/6684892.html
Copyright © 2020-2023  润新知