“ create-react-app”不会创建任何项目

时间:2018-10-06 16:01:01

标签: reactjs

我正试图第一次使用 ReactJS ,所以我遵循official tutorial,但无法创建新的 React Project 使用create-react-app

它不起作用,当我运行它时,它什么也不做,请参阅以下内容:

terminal

我也尝试了sudo特权,但没有成功。 有什么建议吗?

注意:我在 Linux Mint 18 Cinnamon

谢谢

更新

enter image description here

sudo npm i -g create-react-app工作正常。

3 个答案:

答案 0 :(得分:0)

好吧,我解决了使用以下命令升级 nodejs npm 的问题:

#include <iostream>
using namespace std;

// Here, Scalar acts as an abstract class, all its goal is to convert your
// class type into some calculable value type (e.g. you can use T as double)
template <typename T>
class Scalar {
public:
    // Converter function is abstract
    virtual operator T() = 0;
};

class AA: public Scalar<double> {
private:
    double a;
public:
    inline double getA() {return a;};
    AA(double a): a(a) {}
    // Implements the converter function in Scalar, T in scalar is mapped
    //    to double because we did Scalar<double>
    virtual operator double() {
        return a;
    }
};

class BB: public Scalar<double> {
private:
    int a;
public:
    inline double getA() {return (double)a;};
    BB(int a): a(a) {}
    virtual operator double() {
        return (double)a;
    }
};

int main() {
    BB tmp(1);
    AA b(7);
    // Here, it is easy for us just to add those, they are automatically converted into doubles, each one like how it is programmed.
    cout << (b + tmp);
    return 0;
}

因此,当前版本为:

result

现在curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash - sudo apt-get install -y nodejs sudo npm install -g create-react-app 命令可以正常工作。

答案 1 :(得分:0)

它可以代替npm使用纱线包管理器来解决问题。

https://yarnpkg.com/en/

要在Linux上安装

https://yarnpkg.com/lang/en/docs/install/#debian-stable

希望它可以解决您的问题

答案 2 :(得分:-1)

不是npx create-react-app <name>吗?

https://reactjs.org/docs/create-a-new-react-app.html