node.js - React JS:在 VS Code 中使用 npx 命令时出现 CREATE_REACT_APP 问题
问题描述
首先,我是使用 npm 和 react JS 之类的新手,所以要温柔,哈哈。我在 Visual Studio Code 中使用 npm CLI 创建新的反应应用程序时遇到了很多麻烦。错误日志文本完整如下:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'create-react-app@latest',
1 verbose cli '--global',
1 verbose cli '--prefix',
1 verbose cli 'C:\\Users\\xxxx\\AppData\\Roaming\\npm-cache\\_npx\\7488',
1 verbose cli '--loglevel',
1 verbose cli 'error',
1 verbose cli '--json'
1 verbose cli ]
2 info using npm@6.14.6
3 info using node@v12.18.3
4 verbose npm-session aeaef96635f9906e
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 404 https://github.com/npm/npm-registry-couchapp/create-react-app 458ms
8 http fetch GET 404 https://github.com/npm/npm-registry-couchapp/create-react-app 177ms
9 silly fetchPackageMetaData error for create-react-app@latest 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
10 timing stage:rollbackFailedOptional Completed in 1ms
11 timing stage:runTopLevelLifecycles Completed in 804ms
12 verbose stack Error: 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
12 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-registry-fetch\check-response.js:114:15
12 verbose stack at processTicksAndRejections (internal/process/task_queues.js:97:5)
13 verbose statusCode 404
14 verbose pkgid create-react-app@latest
15 verbose cwd C:\Users\xxxx\Documents\Development\Courses\JavaScript\react_todo
16 verbose Windows_NT 10.0.18363
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "create-react-app@latest" "--global" "--prefix" "C:\\Users\\xxxx\\AppData\\Roaming\\npm-cache\\_npx\\7488" "--loglevel" "error" "--json"
18 verbose node v12.18.3
19 verbose npm v6.14.6
20 error code E404
21 error 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
22 error 404
23 error 404 'create-react-app@latest' is not in the npm registry.
24 error 404 You should bug the author to publish it (or use the name yourself!)
25 error 404 Note that you can also install from a
26 error 404 tarball, folder, http url, or git url.
27 verbose exit [ 1, true ]
显然,我可以看到它试图通过 GET 请求到达的 github 路径不存在,我已经查看了很多网站来解决这个问题,到目前为止我尝试的一切都未能解决这个问题。
我试过了:npm uninstall -g然后是npm install -g create-react-app
我尝试使用npm cache clean --force清除 npm 缓存
基本上我很茫然,非常感谢提供的任何指导。
提前致谢!担
编辑:以下是我运行npx create-react-app myApp时得到的文本
npm ERR! code E404
npm ERR! 404 Not Found - GET https://github.com/npm/npm-registry-couchapp/create-react-app - Not Found
npm ERR! 404
npm ERR! 404 'create-react-app@latest' is not in the npm registry.
npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
npm ERR! 404
npm ERR! 404 Note that you can also install from a
npm ERR! 404 tarball, folder, http url, or git url.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\xxxx\AppData\Roaming\npm-cache\_logs\2020-08-03T13_11_39_879Z-debug.log
Install for [ 'create-react-app@latest' ] failed with code 1
解决方案
问题是指向了错误的注册表。npm config set registry https://registry.npmjs.com/
从提示符或终端运行修复。感谢那些试图提供帮助的人。
推荐阅读
- android - Android - 地图 - 我的位置按钮不起作用且蓝点未显示
- javascript - 使用 data-background-iframe 刷新由reveal.js调用的外部页面
- java - 如何将 putIntExtra 用于 int 变量?var 类型错误
- delphi - 在 Delphi 中添加字符串和变体
- python - 根据另一个数据帧的多个特征过滤数据帧
- python-3.x - xlwings 给出 ('Member not found.', None, None) 错误
- r - 使用 Purrr 将循环转换为函数式编程 - 但仅适用于变量向量
- visual-studio-2015 - 用于创建配置文件的 Visual Studio webtest
- python - 使用带有 Python 的 libvlc 流式传输播放列表
- python-3.x - Aesthetics Plotly - 离线模式下的标题