4

I am working offline without any internet connectivity. I have node JS installed on my system. When I am trying to run the npm create-react-app command it gives me error. Is there any way for me to run npm commands and get react application running offline? Below is the error code I get:

npm ERR! code ENOTFOUND
npm ERR! errcode ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/create-react-app failed,
reason: getaddrinfo ENOTFOUND registry.npmjs.org
1
  • 1
    npm install and npx create-react-app download npm packages from npm. You can't install npm packages without an internet connection. Once you have installed the packages, you can then work offline, but obviously won't be able to update or re-install packages. Commented Mar 26, 2020 at 8:45

2 Answers 2

2

and get react application running offline

npm start works offline already. Once you created your application, you should have no problem.

i am trying to run the npm create-react-app command [offline]

Npm is basically a package manager, which downloads dependencies for you, located under /node_modules at your project root.

create-react-app does two things :

  • Install specific dependencies for React : as a huge framework, React doesn't only require Node.js to run, but also multiple other packages (including React istelf).
  • Creating a template project with some presets.

If you are working offline and need to create multiple React projects that way, then you'll have no choice but to run the create-react-app command at least once while being online.

However, once you created your first React app, you can just leave the folder untouched : this will give you a fully functional offline copy for your React applications.

When you're back offline, just copy those files to the folder of the React application you want to create (make sure to copy everything, including the node_modules folder). You should then be able to run npm start offline, and build your application.

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

Comments

0

I believe this is what you are looking for

https://npm.io/package/create-react-app-offline

It helps you create (download) a react project installer, which you can use to create any react JavaScript project offline.

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.