4
npm ERR! Linux 4.15.0-36-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "install" "-g" "create-react-app"
npm ERR! node v8.10.0
npm ERR! npm  v3.5.2
npm ERR! path /tmp/npm-7054-19e3727d
npm ERR! code EROFS
npm ERR! errno -30
npm ERR! syscall mkdir

npm ERR! rofs EROFS: read-only file system, mkdir '/tmp/npm-7054-19e3727d'
npm ERR! rofs This is most likely not a problem with npm itself
npm ERR! rofs and is related to the file system being read-only.
npm ERR! rofs 
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.

npm ERR! Please include the following file with any support request:
npm ERR!     /home/path[...]/npm-debug.log

I have just started learning react and I get this following error when I try to install the create-react-app.

I use Ubuntu 18.04.1 LTS.

I looked online but the solutions that I found so far were not very helpful. What I have tried already:

1. Reinstalling nodejs and npm 
2. Creating .npm-global and and adding the file to the path
3. Tried --no-bin-links
7
  • looks like you have a read only folder that you are trying to mutate. probably should chown it Commented Nov 8, 2018 at 2:48
  • You may want to try adding the --no-bin-links argument to the install command. e.g. $ npm install create-react-app --no-bin-links, however I'm not sure how reliant create-react-app is on having bin links - but worth trying. Commented Nov 8, 2018 at 10:07
  • If using docker you can try to pin down the npm version as mentioned here: github.com/npm/cli/issues/4838#issuecomment-1148412095. Hard to debug without more specific information about the bounty issuer's environment/setup. Commented Oct 16, 2022 at 14:39
  • 1
    Could you please check your node/npm version? reactjs.org/docs/create-a-new-react-app.html says Node >= 14.0.0 and npm >= 5.6 Commented Oct 18, 2022 at 12:00
  • what is the location you currently trying to run this command please type pwd at terminal at the location you trying to run npx create-react-app and add it to the question Commented Oct 18, 2022 at 19:11

3 Answers 3

1

I assume you have installed Node.js through the apt package manager.

Unfortunately the version provided for bionic (18.04LTS) is rather old and as per @Anton's comment create-react-app requires Node.js version 14 and up.

So uninstall the version of nodejs you acquired from apt via sudo apt-get purge --auto-remove nodejs.

Then following the instructions provided on Node.js's site.

Install a more recent version of Node.js from NodeSource's Ubuntu installation scripts.

I would recommend the latest LTS version which is current version 16.

curl -fsSL https://deb.nodesource.com/setup_16.x | sudo -E bash - &&\
sudo apt-get install -y nodejs

Then attempt to reinstall create-react-app via npm install -g create-react-app.

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

1 Comment

Also, create-react-app doesn't recommend a global install anymore, npx create-react-app is preferred (reactjs.org/docs/create-a-new-react-app.html#create-react-app)
1
+200

This error appears when your hard disk file cannot be read or there is a problem among the files. Try to test in another drive and hard disk space.

Comments

0

Try deleting the npm modules directory and run npm install or yarn install again.

If you’re running a fresh machine without nodejs installed, I highly recommend downloading node with NVM manager.

Just google “Install node with nvm” usually Digital Ocean writes good blogs that are really easy to follow

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.