[英]How to run npm commands like create-react-app offline
I am working offline without any internet connectivity.我在没有任何互联网连接的情况下离线工作。 I have node JS installed on my system.
我的系统上安装了节点 JS。 When i am trying to run the npm create-react-app command it gives me error.
当我尝试运行 npm create-react-app命令时,它给了我错误。 Is there any way for me to run npm commands and get react application running offline.
有什么方法可以让我运行 npm 命令并使 React 应用程序脱机运行。 Below is the error code i get:
下面是我得到的错误代码:
npm ERR! errcode ENOTFOUND
npm ERR! network request to https://registry.npmjs.org/create-react-app failed,
reason: getaddrinfo ENOTFOUND registry.npmjs.org```
and get react application running offline
并让 React 应用程序离线运行
npm start
works offline already. npm start
已经可以离线工作了。 Once you created your application, you should have no problem.创建应用程序后,您应该没有问题。
i am trying to run the npm create-react-app command [offline]
我正在尝试运行 npm create-react-app 命令 [离线]
Npm is basically a package manager, which downloads dependencies for you, located under /node_modules at your project root. Npm 基本上是一个包管理器,它为您下载依赖项,位于项目根目录的 /node_modules 下。
create-react-app
does two things : create-react-app
做了两件事:
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.如果您离线工作并且需要以这种方式创建多个 React 项目,那么您将别无选择,只能在在线时至少运行一次
create-react-app
命令。
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.然而,一旦你创建了你的第一个 React 应用程序,你就可以保持文件夹不变:这将为你的 React 应用程序提供一个功能齐全的离线副本。
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).当您重新离线时,只需将这些文件复制到您要创建的 React 应用程序的文件夹中(确保复制所有内容,包括 node_modules 文件夹)。 You should then be able to run
npm start
offline, and build your application.然后,您应该能够离线运行
npm start
并构建您的应用程序。
i believe this is what u are looking for我相信这就是你要找的
https://npm.io/package/create-react-app-offline https://npm.io/package/create-react-app-offline
it helps you create (download) a react project installer, which u can use to create any react js project offline.它可以帮助您创建(下载)一个 react 项目安装程序,您可以使用它来离线创建任何 react js 项目。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.