简体   繁体   English

无法使用 npm 安装任何东西(反应)

[英]Can't install anything with npm (react)

I have cloned the Hot Reload Boilerplate ( https://github.com/gaearon/react-hot-boilerplate ) for my first react project.我已经为我的第一个 react 项目克隆了 Hot Reload Boilerplate ( https://github.com/gaearon/react-hot-boilerplate )。

Some days ago could install React Router using npm install --save react-router .几天前可以使用npm install --save react-router安装 React Router。 But now I would like to install dependencies like Axios to get data using JSON ( https://github.com/mzabriskie/axios ), or this ReactCSSTransitionGroup from https://facebook.github.io/react/docs/animation.html , but when I run npm install axios I keep getting these errors:但是现在我想安装像 Axios 这样的依赖项来使用 JSON ( https://github.com/mzabriskie/axios ) 或这个 ReactCSSTransitionGroup 从https://facebook.github.io/react/docs/animation.html获取数据,但是当我运行npm install axios我不断收到这些错误:

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "--save" "axios"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react@0.14.8 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-dom@0.14.8 wants react@^0.14.8
npm ERR! peerinvalid Peer react-router@3.0.0 wants react@^0.14.0 || ^15.0.0
npm ERR! peerinvalid Peer react-addons-css-transition-group@15.3.2 wants react@^15.3.2

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Ludo/Documents/sites/react/FirstApp/npm-debug.log

And also when I run something like npm i I get these errors:而且当我运行npm i东西时,我会收到以下错误:

npm ERR! Darwin 15.6.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "i"
npm ERR! node v4.5.0
npm ERR! npm  v2.15.9
npm ERR! code EPEERINVALID

npm ERR! peerinvalid The package react@0.14.8 does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer react-dom@0.14.8 wants react@^0.14.8
npm ERR! peerinvalid Peer react-router@3.0.0 wants react@^0.14.0 || ^15.0.0
npm ERR! peerinvalid Peer react-addons-css-transition-group@15.3.2 wants react@^15.3.2

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Ludo/Documents/sites/react/FirstApp/npm-debug.log

What does this mean, and how can I fix this?这是什么意思,我该如何解决?

Thanks!谢谢!

You're using an old version of npm (2.15.9).您使用的是旧版本的npm (2.15.9)。 Run this to update it...运行它来更新它...

$ npm install -g npm

Then attempt to install your dependencies again.然后再次尝试安装您的依赖项。

PS C:\\Users\\a\\Desktop\\project 1> npm version { npm: '8.3.0', PS C:\\Users\\a\\Desktop\\project 1> npm 版本 { npm: '8.3.0',
node: '17.3.0', v8: '9.6.180.15-node.12', uv: '1.42.0', zlib: '1.2.11', brotli: '1.0.9', ares: '1.18.1', modules: '102', nghttp2: '1.45.1', napi: '8', llhttp: '6.0.4', cldr: '40.0', icu: '70.1', tz: '2021a3', unicode: '14.0', ngtcp2: '0.1.0-DEV', nghttp3: '0.1.0-DEV' } PS C:\\Users\\a\\Desktop\\project 1> npx create-react-app my-app Need to install the following packages: create-react-app Ok to proceed?节点:'17.3.0',v8:'9.6.180.15-node.12',uv:'1.42.0',zlib:'1.2.11',brotli:'1.0.9',ares:'1.18.1 ', 模块: '102', nghttp2: '1.45.1',​​ napi: '8', llhttp: '6.0.4', cldr: '40.0', icu: '70.1', tz: '2021a3', unicode: '14.0', ngtcp2: '0.1.0-DEV', nghttp3: '0.1.0-DEV' } PS C:\\Users\\a\\Desktop\\project 1> npx create-react-app my-app 需要安装以下软件包: create-react-app 确定继续吗? (y) y (y) 是

You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).您正在运行create-react-app 4.0.3,它落后于最新版本 (5.0.0)。

We no longer support global installation of Create React App.我们不再支持全局安装 Create React App。 Please remove any global installs with one of the following commands:请使用以下命令之一删除任何全局安装:

  • npm uninstall -g create-react-app npm uninstall -g create-react-app
  • yarn global remove create-react-app纱线全局删除 create-react-app

https://create-react-app.dev/docs/getting-started/ https://create-react-app.dev/docs/getting-started/

PS C:\\Users\\a\\Desktop\\project 1> npm update PS C:\\Users\\a\\Desktop\\project 1> npm 更新

up to date, audited 1 package in 3s最新,3 秒审核 1 个包裹

found 0 vulnerabilities PS C:\\Users\\a\\Desktop\\project 1> npx create-react-app my-app Need to install the following packages: create-react-app Ok to proceed?发现 0 个漏洞 PS C:\\Users\\a\\Desktop\\project 1> npx create-react-app my-app 需要安装以下包: create-react-app 确定继续? (y) (y)

You are running create-react-app 4.0.3, which is behind the latest release (5.0.0).您正在运行create-react-app 4.0.3,它落后于最新版本 (5.0.0)。

We no longer support global installation of Create React App.我们不再支持全局安装 Create React App。 Please remove any global installs with one of the following commands:请使用以下命令之一删除任何全局安装:

PS C:\\Users\\a\\Desktop\\project 1> npx clear-npx-cache Need to install the following packages: clear-npx-cache Ok to proceed? PS C:\\Users\\a\\Desktop\\project 1> npx clear-npx-cache 需要安装以下包: clear-npx-cache 确定继续? (y) y PS C:\\Users\\a\\Desktop\\project 1> npx create-react-app my-app Need to install the following packages: create-react-app Ok to proceed? (y) y PS C:\\Users\\a\\Desktop\\project 1> npx create-react-app my-app 需要安装以下包: create-react-app 确定继续? (y) y (y) 是

this will work clear-npx-cache这将工作 clear-npx-cache

如果您打开了自动保存,请尝试取消选中它。

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

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