Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
355 views
in Technique[技术] by (71.8m points)

node.js - create-react-app, installation error ("command not found")

I have installed create-react-app exactly as instructed on the facebook instruction page (https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html):

First, install the global package:

npm install -g create-react-app

I did this. It appeared to work fine - the file was installed to

users/*name*/.node_modules_global/lib/node_modules/create-react-app

I'm not really sure why global install takes it to this path, but there you have it.

Next instruction:

Now you can use it to create a new app:

create-react-app hello-world

Couldn't be simpler, right? But Terminal spits out this at me:

-bash: create-react-app: command not found

It's probably something very simple I'm missing but I don't really know where to look. If anyone can help I'd really appreciate it!

Thanks in advance.

Note: I'm using Node v6.3.1, and npm v3.10.3

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You are able to apply the following solution:

$ npm config set prefix /usr/local
$ sudo npm install -g create-react-app
$ create-react-app my-app

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

1.4m articles

1.4m replys

5 comments

57.0k users

...