繁体   English   中英

使用 npm 全局安装 create-react-app 时出错

[英]Error while installing create-react-app globally using npm

我无法使用 NPM 安装 react js。 我收到以下错误。 您的环境已设置为使用 Node.js 12.3.1 (ia32) 和 npm。

C:\\Users\\User>npm install create-react-app -g

npm 错误! 代码 UNABLE_TO_VERIFY_LEAF_SIGNATURE

npm 错误! 错误号 UNABLE_TO_VERIFY_LEAF_SIGNATURE

npm 错误! https://registry.npmjs.org/create-react-app 的请求失败,原因:

无法验证第一个证书

npm 错误! 可以在以下位置找到此运行的完整日志:

npm 错误! C:\\Users\\User\\AppData\\Roaming\\npm-cache_logs\\2019-12-14T05_54_58_7

16Z-debug.log

我来自印度,我没有使用任何公司防火墙或 VPN。

嘿,您可以尝试使用npx create-react-app ${your project name}

我在命令行中运行了以下命令并为我工作:

npm config set strict-ssl false

虽然这不是一个好主意。

运行此命令以再次打开它:

npm config set strict-ssl true

下载 Node.js 档案

  • Node.js 下载下载最新版本的 Node.js 可安装存档文件。

成功安装 NodeJS 后,我们可以开始使用 npm 在其上安装 React。 您可以通过两种方式安装 ReactJS。

- Using webpack and babel.
- Using the create-react-app command.

但我要告诉你使用 create-react-app 命令:

- Instead of using webpack and babel you can install ReactJS more simply by installing create-react-app.

Browse through the desktop and install the Create React App using command prompt as shown below: 

Step 1: go to your specific directory and run below commands inside the folder like as below:
Step 2: d:\reactproject\>npx create-react-app my-app
Step 3: cd my-app
Step 4: npm start

检查您的日期是否正确。 如果它没有运行,然后再试一次:

sudo date --set="2015-09-30 10:05:59.990"

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM