Hello I recently tried installing grunt-command line interface according to the instructions on their website using the node package manager command
sudo npm install -g grunt-cli
It didnt work and I got the following errors
/usr/local/bin/grunt -> /usr/local/lib/node_modules/grunt-cli/bin/grunt
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/couch-login requires request#'~2.9.202' but will load
npm WARN unmet dependency /usr/local/lib/node_modules/npm/node_modules/request,
npm WARN unmet dependency which is version 2.30.0
grunt-cli#0.1.13 /usr/local/lib/node_modules/grunt-cli
├── resolve#0.3.1
├── nopt#1.0.10 (abbrev#1.0.5)
└── findup-sync#0.1.3 (lodash#2.4.1, glob#3.2.11)
➜ ~
I'm not sure how i update this dependancy. Can anyone shed any light on this?
Try the following:
npm cache clean
npm install -g npm (update npm)
reinstall node.js completely (if all fails).
Please let me know if this works.
Related
Im working with AWS-Amplify and just updated it's CLI to the latest version, and now NPM complains that there are unmet dependencies, though graphql is clearly installed at the right version. What am missing here? Thanks for any clarification!
$ npm list -g --depth 0
/usr/local/lib
├── #aws-amplify/cli#4.12.0
├── #vue/cli#4.0.5
├── browser-sync#2.26.7
├── firebase-tools#7.10.0
├── graphql#14.5.8
├── nodemon#2.0.2
├── npm#6.13.6
└── parcel-bundler#1.12.4
npm ERR! peer dep missing: graphql#^14.5.8, required by #graphql-toolkit/file-loading#0.9.0
npm ERR! peer dep missing: graphql#^14.2.0, required by relay-compiler#6.0.0
This happens when your node version is not latest or when the dependencies require a certain version of other npm. Just check if all the npm packages and node is of latest version.
After npm install on clean environment, I get following problem with b package:
npm ls b
a#2.0.6
├── b#3.0.0
├─┬ c#3.0.1
│ └── UNMET DEPENDENCY b#^1.0.0
└─┬ d#4.1.1
└─┬ c#2.1.0
└── UNMET DEPENDENCY b#^1.0.0
npm ERR! missing: b#^1.0.0, required by c#3.0.1
npm ERR! missing: b#^1.0.0, required by c#2.1.0
This obviously causes errors, as package c needs b#^1.0.0, but receives b#3.0.0.
I struggled to force npm to install both versions as if they were different packages. Tried going through npm docs, package-locks, and shinkwrap, but with no success. How can I solve this problem?
Environment info:
OS: macOS High Sierra 10.13.4
npm: 6.10
node: v8.8.1
Playing around I noticed, that a lot of packages had UNMET DEPENDENCY. Following procedure fixed the problem:
rm -rf node_modules
npm cache clean --force
npm install
After cleaning npm cache the issue is completely resolved:
a#2.0.6
├── b#3.0.0
├─┬ c#3.0.1
│ └── b#^1.0.0
└─┬ d#4.1.1
└─┬ c#2.1.0
└── b#^1.0.0
Strange bug.
When i install karma-jasmine on mac,it gives me errors:
├── UNMET PEER DEPENDENCY jasmine-core#*
└── karma-jasmine#0.3.8
npm WARN karma-jasmine#0.3.8 requires a peer of jasmine-core#* but none was installed.
But,i have installed jasmine-core just before.
npm install jasmine-core -g
/Users/hbowang/.nvm/versions/node/v5.9.0/lib
└── jasmine-core#2.4.1
Any body can help me resolve this error?
I also got this error, but my package.json file is also missing so by creating package json file i am able to install jasmine-core and karma-jasmine.
For creating package.json file:
$ npm init
then after install jasmine-core:
$ npm install jasmine-core
$ npm install karma --save-dev
$ npm install karma-jasmine --save-dev
Hope it will help!!
you are installing jasmine-core with the global flag.
try installing it without the -g option and then retry.
notice the words UNMET PEER DEPENDENCY which suggests it wants it installed at the same level not globally maybe?
For example, when I install Angular2:
npm install --save angular2
temp#1.0.0 /Users/doug/Projects/dougludlow/temp
├── angular2#2.0.0-beta.3
├── UNMET PEER DEPENDENCY es6-promise#^3.0.2
├── UNMET PEER DEPENDENCY es6-shim#^0.33.3
├── UNMET PEER DEPENDENCY reflect-metadata#0.1.2
├── UNMET PEER DEPENDENCY rxjs#5.0.0-beta.0
└── UNMET PEER DEPENDENCY zone.js#0.5.11
npm WARN angular2#2.0.0-beta.3 requires a peer of es6-promise#^3.0.2 but none was installed.
npm WARN angular2#2.0.0-beta.3 requires a peer of es6-shim#^0.33.3 but none was installed.
npm WARN angular2#2.0.0-beta.3 requires a peer of reflect-metadata#0.1.2 but none was installed.
npm WARN angular2#2.0.0-beta.3 requires a peer of rxjs#5.0.0-beta.0 but none was installed.
npm WARN angular2#2.0.0-beta.3 requires a peer of zone.js#0.5.11 but none was installed.
Is there a magic flag that I can pass to npm that will install the peer dependencies as well? I haven't been able to find one... It's tedious to manually copy and paste the peer dependencies and make sure I have the correct versions.
In other words, I'd rather not have to do:
npm install --save angular2#2.0.0-beta.3 es6-promise#^3.0.2 es6-shim#^0.33.3 reflect-metadata#0.1.2 rxjs#5.0.0-beta.0 zone.js#0.5.11
What is the better way?
npm version 7 and newer
npm v7 has reintroduced the automatic peerDependencies installation. Now in V7, as in versions before V3, you only need to do an npm i and all peerDependences should be automatically installed.
They had made some changes to fix old problems as version compatibility across multiple dependants.
You can see the discussion and the announcement.
Older Answer
The automatic install of peer dependencies was explicitly removed with npm 3, as it cause more problems than it tried to solve. You can read about it here for example:
https://blog.npmjs.org/post/110924823920/npm-weekly-5
https://github.com/npm/npm/releases/tag/v3.0.0
So no, for the reasons given, you cannot install them automatically with npm 3 upwards.
I solved it by rewriting package.json with the exact values warnings were about.
Warnings when running npm:
npm WARN angular2#2.0.0-beta.3 requires a peer of es6-shim#^0.33.3 but none was installed.
npm WARN angular2#2.0.0-beta.3 requires a peer of reflect-metadata#0.1.2
In package.json, write
"es6-shim": "^0.33.3",
"reflect-metadata": "0.1.2",
Then, delete node_modules directory.
Finally, run the command below:
npm install
Cheat code helpful in this scenario and some others...
├── UNMET PEER DEPENDENCY #angular/common#4.0.2
├── UNMET PEER DEPENDENCY #angular/compiler#4.0.2
├── UNMET PEER DEPENDENCY #angular/compiler-cli#4.0.2
├── UNMET PEER DEPENDENCY #angular/core#4.0.2
├── UNMET PEER DEPENDENCY #angular/forms#4.0.2
├── UNMET PEER DEPENDENCY #angular/http#4.0.2
├── UNMET PEER DEPENDENCY #angular/platform-browser#4.0.2
├── UNMET PEER DEPENDENCY #angular/platform-browser-dynamic#4.0.2 >
copy & paste your error into your code editor.
Highlight an unwanted part with your curser. In this case ├── UNMET PEER DEPENDENCY
Press command + d a bunch of times.
Press delete twice. (Press space if you accidentally highlighted ├── UNMET PEER DEPENDENCY )
Press up once. Add npm install
Press down once. Add --save
Copy your stuff back into the cli and run
npm install #angular/common#4.0.2 #angular/compiler#4.0.2 #angular/compiler-cli#4.0.2 #angular/core#4.0.2 #angular/forms#4.0.2 #angular/http#4.0.2 #angular/platform-browser#4.0.2 #angular/platform-browser-dynamic#4.0.2 --save
I experienced these errors when I was developing an npm package that had peerDependencies. I had to ensure that any peerDependencies were also listed as devDependencies. The project would not automatically use the globally installed packages.
The project npm-install-peers will detect peers and install them.
As of v1.0.1 it doesn't support writing back to the package.json automatically, which would essentially solve our need here.
Please add your support to issue in flight: https://github.com/spatie/npm-install-peers/issues/4
I was facing the same issue, lucky I found an alternative way to install peer dependencies along with the install command.
Step 1: $ npm i npm-install-peers -D
for more clarity about the plugin: https://www.npmjs.com/package/npm-install-peers
Step 2: Update package.json for magical script
....
"scripts": {
...
"postinstall": "npm-install-peers"
},
....
Step 3: Just need to hit the install command to get installed all plugins
$ npm install
Install yarn and then run:
yarn global add install-peerdeps
i tried to clean the cache and install it again but it says a warning unmet dependency
C:\Users\Ralph>npm cache clean
C:\Users\Ralph>npm install -g cordova
C:\Users\Ralph\AppData\Roaming\npm\cordova -> C:\Users\Ralph\AppData\Roaming\npm
\node_modules\cordova\bin\cordova
npm WARN unmet dependency C:\Users\Ralph\AppData\Roaming\npm\node_modules\phoneg
ap\node_modules\connect-phonegap requires shelljs#'0.2.6' but will load
npm WARN unmet dependency C:\Users\Ralph\AppData\Roaming\npm\node_modules\phoneg
ap\node_modules\shelljs,
npm WARN unmet dependency which is version 0.1.4
npm WARN unmet dependency C:\Users\Ralph\AppData\Roaming\npm\node_modules\phoneg
ap\node_modules\cordova\node_modules\plugman requires request#'2.22.0' but will
load
npm WARN unmet dependency C:\Users\Ralph\AppData\Roaming\npm\node_modules\phoneg
ap\node_modules\cordova\node_modules\request,
npm WARN unmet dependency which is version 2.21.0
cordova#4.2.0 C:\Users\Ralph\AppData\Roaming\npm\node_modules\cordova
├── underscore#1.7.0
├── q#1.0.1
├── nopt#3.0.1 (abbrev#1.0.5)
└── cordova-lib#4.2.0 (valid-identifier#0.0.1, osenv#0.1.0, properties-parser#0.
2.3, bplist-parser#0.0.6, mime#1.2.11, unorm#1.3.3, semver#2.0.11, shelljs#0.3.0
, rc#0.5.2, dep-graph#1.1.0, npm#1.4.28, elementtree#0.1.5, xcode#0.6.7, through
2#0.6.3, npmconf#0.1.16, glob#4.0.6, plist#1.1.0, tar#1.0.2, request#2.47.0, d8#
0.4.4, cordova-js#3.7.3)
thank you in advance
Cordova cannot run on the latest version of Node because it actually requires v10.x of Node. So, here is how I avoided the "Warning: unmet dependency" when installing Cordova:
> npm uninstall -g cordova
Use n (nvm for Windows) to downgrade an older version of Node (Windows users will need to downgrade and use):
> n 0.10.40
> npm cache clean
> npm install -g cordova
If you want to install Ionic, then in step 4, call the npm command to directly install ionic (with no #latest) instead of cordova, like this:
> npm install -g ionic
Note: Linux / OSX users may need to prepend the npm commands with "sudo".