npm install reactjs app npm ERR!代码E404

时间:2018-06-07 02:53:59

标签: node.js reactjs npm

我是reactjs的新手,我正在尝试创建一个reactjs应用程序,我按照反应网页上的步骤,它显示错误。我的节点版本是v8.11.1.npx版本是9.7.1。

btw我可以使用npx create-react-app创建应用程序,但是在使用npm时失败。

Teddys-MacBook-Pro:Desktop teddy$ npm install -g create-react-app 
create-react-app amber_Web 
npm ERR! code E404
npm ERR! 404 Not Found: amber_Web@latest

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/teddy/.npm/_logs/2018-06-07T02_08_37_384Z-debug.log

这是日志文件: 0 info it worked if it ends with ok 1 verbose cli [ '/usr/local/bin/node', 1 verbose cli '/usr/local/bin/npm', 1 verbose cli 'install', 1 verbose cli '-g', 1 verbose cli 'create-react-app', 1 verbose cli 'create-react-app', 1 verbose cli 'amber_Web' ] 2 info using npm@5.6.0 3 info using node@v8.11.1 4 verbose npm-session 452b1b32f613b960 5 silly install loadCurrentTree 6 silly install readGlobalPackageData 7 http fetch GET 200 https://registry.npmjs.org/create-react-app 32ms (from cache) 8 silly pacote tag manifest for create-react-app@latest fetched in 52ms 9 http fetch GET 404 https://registry.npmjs.org/amber_Web 1545ms 10 silly fetchPackageMetaData error for amber_Web@latest 404 Not Found: amber_Web@latest 11 verbose stack Error: 404 Not Found: amber_Web@latest 11 verbose stack at fetch.then.res (/usr/local/lib/node_modules/npm/node_modules/pacote/lib/fetchers/registry/fetch.js:42:19) 11 verbose stack at tryCatcher (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/util.js:16:23) 11 verbose stack at Promise._settlePromiseFromHandler (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:512:31) 11 verbose stack at Promise._settlePromise (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:569:18) 11 verbose stack at Promise._settlePromise0 (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:614:10) 11 verbose stack at Promise._settlePromises (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/promise.js:693:18) 11 verbose stack at Async._drainQueue (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:133:16) 11 verbose stack at Async._drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:143:10) 11 verbose stack at Immediate.Async.drainQueues (/usr/local/lib/node_modules/npm/node_modules/bluebird/js/release/async.js:17:14) 11 verbose stack at runCallback (timers.js:794:20) 11 verbose stack at tryOnImmediate (timers.js:752:5) 11 verbose stack at processImmediate [as _immediateCallback] (timers.js:729:5) 12 verbose cwd /Users/teddy/Desktop 13 verbose Darwin 17.5.0 14 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "create-react-app" "create-react-app" "amber_Web" 15 verbose node v8.11.1 16 verbose npm v5.6.0 17 error code E404 18 error 404 Not Found: amber_Web@latest 19 verbose exit [ 1, true ] 感谢。

5 个答案:

答案 0 :(得分:1)

您似乎尝试在安装时运行create-react-app。

运行npm install -g create-react-app虽然这应该已经安装。

然后运行create-react-app amber_Web

修改

这个错误的原因是因为你把npm install -g create-react-app create-react-app amber_Web全部放在一个命令告诉npm安装create-react-app包两次和amber_Web包但是那个包不存在因此404错误

答案 1 :(得分:1)

错误是因为npm遵循应用程序命名约定,根据该约定,也不允许在应用程序名称中使用大写字母。

请尝试使用create-react-app amber_web

要了解更多信息,请访问:npmjs docs

答案 2 :(得分:1)

我认为现金和aslo react安装都可能有问题,所以你应该试试:

npm cache clean --force

然后

npm install -g create-react-app

之后看看你的安装是否正确

create-react-app --version

如果它工作,那么现在一切都好,但如果不是,那么你应该尝试卸载 node.js 并尝试搜索它的所有缓存文件夹删除它们并安装为新的 node.js 然后安装反应 js。

答案 3 :(得分:0)

尝试:
npm医生

npm ping

“ npm doctor运行一组检查以确保您的npm安装具有管理JavaScript软件包所需的内容。”

答案 4 :(得分:0)

尝试

npm cache clean --force

然后

create-react-app your_app_name