2

I've installed nodejs and npm using sudo apt-get. I've installed create-react-app using sudo npm install -g create-react-app but when I try to use create-react-app, it does absolutely nothing.

This $ create-react-app my-app did not create a directory.

I tried to make the directory and see if I could get create-react-app to populate it. This $ mkdir my-app $ create-react-app my-app did absolutely nothing too.. The my-app directory stayed completely empty. It didn't even give an en error message.

How do I get create-react-app to work? To create and populate a directory as I think it should?

Update: when I installed create-react-app, I got the following warning. npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.10"})

2 Answers 2

1

Did you try installing it globally?

i.e.

sudo npm install -g create-react-app

or

npm install -g create-react-app

create-react-app is a command line tool, so it needs to be installed globally in order for you to use it.

Sign up to request clarification or add additional context in comments.

3 Comments

I did and with sudo and -g as well. I did get the following warning though: npm WARN engine [email protected]: wanted: {"node":">=4"} (current: {"node":"v0.10.25","npm":"1.3.10"})
@sebastianspiegel it looks like your node version is 0.10.25, but you need version 4 or greater to use create-react-app - facebook.github.io/react/blog/2016/07/22/… - I find switching node versions to be easiest with nvm i.e. node version manager. nvm allows you to have multiple versions of Node.js installed and to easily switch between those versions.
to piggy back on sebastian, nvm is the way to go. Just make sure you've got it set to override the system node or you'll have to keep setting your node version every time you ssh into your server.
1

I figured it out. I needed to upgrade my version of nodejs using npm. I got the answer from this website. I skipped the first command that they recommend $ sudo npm cache clean -f, but probably should have done it. I used to following two commands.

$ sudo npm install -g n $ sudo n stable

create-react-app now works fine.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.