简体   繁体   中英

npm peerDependency - can't install package

I'm new to npm world, so maybe it's easy. The problem is the following:

I have a project with installed react v.15.2.0 , and I need to install a package, eg react typist - https://github.com/jstejada/react-typist . When I do it, I gen an error: (npm v2.*)

npm ERR! peerinvalid The package react@15.2.1 does not satisfy its siblings' peerDependencies requirements!

Reading on the internet, I followed an advice to update npm itself to v.3, so I did it by running npm install -g npm . But the error is still there:

+-- UNMET PEER DEPENDENCY react@15.2.1

I assume, that I need to update react to v.15.2.1 , but don't know how to do it. Running npm update doesn't help, still same error. Could you please advice, how to solve the issue?

在此处输入图片说明

在此处输入图片说明

在此处输入图片说明

Thanks.

The version message is the other way around to what you're thinking. It's saying "the version of react that you have is 15.2.1 and that doesn't match what react-typist needs".

Indeed if you look in the react typist package.json you'll see that they require version 0.14 of React. That's the problem. Looks like the repo hasn't been touched for almost a year, so you might want to pick something else, or fork it and make some changes.

EDIT: If you want to update your npm package, you should do the following.

On your package.json file look for the line:

"react": "^15.2.0",

change the version number 15.2.0 to 15.2.1 and run npm install . It'll update your react to 15.2.1 .

But the main detail you should have included in your question is the following warning:

react-typist@0.3.0 requires a peer of react@^0.14 but none was installed.

The recommended method is the one David Gilbertson suggested:

Indeed if you look in the react typist package.json you'll see that they require version 0.14 of React. That's the problem. Looks like the repo hasn't been touched for almost a year, so you might want to pick something else, or fork it and make some changes.

If you really want to use this component and function properly, you'll have to downgrade to react 0.14 , which isn't recommended.

To downgrade use: npm install --save react@^0.14

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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