Reading peerinvalid Output - npm

Taking the following output from a vanilla npm install:
npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-tslint#2.5.0 wants grunt#~0.4.5
npm ERR! peerinvalid Peer grunt-processhtml#0.3.13 wants grunt#>=0.4.x
npm ERR! peerinvalid Peer grunt-contrib-copy#0.8.2 wants grunt#>=0.4.0
npm ERR! peerinvalid Peer grunt-bower-install#1.6.0 wants grunt#~0.4.0
npm ERR! peerinvalid Peer grunt-contrib-connect#0.11.2 wants grunt#>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch#0.4.0 wants grunt#~0.4.0
npm ERR! peerinvalid Peer grunt-lesslint#1.4.1 wants grunt#~0.4.5
npm ERR! peerinvalid Peer grunt-typescript#0.8.0 wants grunt#~0.4.5
npm ERR! peerinvalid Peer grunt-bower-concat#0.6.0 wants grunt#~0.4.0
How does one diagnose the dependency version problems from package.json, which has the following dependencies:
"grunt": "0.4.5",
"grunt-bower-concat": "^0.6.0",
"grunt-bower-install": "^1.6.0",
"grunt-bower-task": "^0.4.0",
"grunt-contrib-connect": "0.11.2",
"grunt-contrib-copy": "^0.8.2",
"grunt-contrib-less": "^1.0.1",
"grunt-contrib-watch": "0.4.0",
"grunt-processhtml": "^0.3.8",
"grunt-lesslint": "^1.4.0",
"grunt-tslint": "^2.4.0",
"grunt-typescript": "^0.8.0",
"matchdep": "~0.1.1",
"tslint": "^2.4.2"
The peerDependencies have the following distinct rules:
~0.4.5 :: True, grunt dependency is hard-coded as exactly 0.4.5
>=0.4.x :: True, 0.4.5 >= 0.4.x
>=0.4.0 :: True, 0.4.5 >= 0.4.0
~0.4.0 :: True, 0.4.5 is a patch of 0.4.0
All of these pass for the stated version of the grunt dependency. Why does NPM still complain?

When npm install is executed it will assess the compatibility of the packages that are currently installed.
Starting from a blank node_modules directory, a package.json with the dependencies described above will install successfully.
The root cause of this issue is manually installing a later version of grunt:
# First NPM install, works sucecssfully
npm install
# Upgrade to later version of grunt, note we're not adding --save
npm install grunt#1.0.0
# NPM install now fails with incompatibility error
npm install
In this case, the package.json file still shows grunt at version 0.4.5, but the installed module is still 1.0.0.
To find a list of the installed modules, one should consult npm list

Related

How to add Jest-React testing library to Expo

I'm trying to install Jest and React testing library to my expo project(sdk 47). While installing i'm getting dependency conflict. i'm new to testing can you please help me how to install
Found: react#18.1.0 npm ERR! node_modules/react npm ERR!
react#"18.1.0" from the root project npm ERR! peer react#">=16.0.0"
from #testing-library/react-native#11.5.0 npm ERR!
node_modules/#testing-library/react-native npm ERR!
#testing-library/react-native#"" from the root project npm ERR! 1
more (react-native) npm ERR! npm ERR! Could not resolve dependency:
npm ERR! peer react#"^18.2.0" from react-test-renderer#18.2.0 npm ERR!
node_modules/react-test-renderer npm ERR!
react-test-renderer#"^18.1.0" from the root project npm ERR! peer
react-test-renderer#">=16.0.0" from
#testing-library/react-native#11.5.0 npm ERR!
node_modules/#testing-library/react-native npm ERR!
#testing-library/react-native#"" from the root project npm ERR! npm
ERR! Fix the upstream dependency conflict, or retry npm ERR! this
command with --force, or --legacy-peer-deps npm ERR! to accept an
incorrect (and potentially broken) dependency resolution. npm ERR! npm
ERR! See C:\Users\rikvitha\AppData\Local\npm-cache\eresolve-report.txt
for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR!
C:\Users\rikvitha\AppData\Local\npm-cache_logs\2023-01-22T05_28_56_533Z-debug-0.log
Are you trying to install React testing library (RTL), or React-Native testing library (RNTL)? Your question say one thing, but your error logs the other, they are two distinct libraries. I am going to assume it's RNTL, because your also using expo.
The error log says that you have several dependencies that are in conflict with each other, i.e. you have a dependency conflict. What I would recommend is to remove the dependencies and add them again (if you have a commit where everything worked, you can do git reset head --hard to throw away your changes). I think your problem is with react-test-renderer, but dependency conflicts are tricky.
These are the versions I use:
"#testing-library/jest-native": "^5.4.1",
"#testing-library/react-native": "^11.5.0",
"#tsconfig/react-native": "^2.0.2",
"#types/jest": "^26.0.24",
"#types/react": "^18.0.21",
"#types/react-native": "^0.70.6",
"#types/react-test-renderer": "^18.0.0",
"babel-jest": "^26.6.3",
"jest": "^26.6.3",
"metro-react-native-babel-preset": "0.72.3",
"react-test-renderer": "18.1.0",
"ts-jest": "^29.0.3",
"typescript": "^4.9.4"
I use react-native (instead of expo) and typescript (instead of js), so there are a few more plugins that you probably don't need, unless your also using TS, but these versions should not conflict with each other.

Unable to resolve dependency tree - React Native Expo

I have been starting my story with React Native (Expo). Someday I needed to install datetimepicker. Unfortunately, I have done something wrong. I tried to face the problem by myself. I removed the node_modeles directory and package.lock.json. When I trying to npm install I get the error below:
error message
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"16.13.1" from the root project
npm ERR! peer react#">=16.8.3" from #react-native-community/datetimepicker#3.4.6
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"^3.0.4" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-native-windows#0.64.3
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows#">=0.62" from #react-native-community/datetimepicker#3.4.6
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"^3.0.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
I know that is something with the wrong versions of dependencies but I have no idea how to fixed it :(
That is my package.json.
UPDATED package.json
{
"main": "node_modules/expo/AppEntry.js",
"scripts": {
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web",
"eject": "expo eject"
},
"dependencies": {
"#react-native-async-storage/async-storage": "^1.13.0",
"#react-native-picker/picker": "1.9.11",
"#react-navigation/bottom-tabs": "^5.11.10",
"#react-navigation/drawer": "^5.12.5",
"#react-navigation/native": "^5.9.4",
"#react-navigation/stack": "^5.14.4",
"#types/expo__vector-icons": "^9.0.1",
"expo": "~41.0.0",
"expo-app-loading": "^1.0.3",
"expo-notifications": "~0.11.5",
"expo-sms": "~9.1.2",
"expo-status-bar": "~1.0.4",
"i18n-js": "^3.8.0",
"moment": "^2.29.1",
"react": "16.13.1",
"react-dom": "16.13.1",
"react-native": "https://github.com/expo/react-native/archive/sdk-41.0.0.tar.gz",
"react-native-gesture-handler": "~1.10.2",
"react-native-pager-view": "5.0.12",
"react-native-reanimated": "~1.13.0",
"react-native-safe-area-context": "3.2.0",
"react-native-screens": "~3.0.0",
"react-native-tab-view": "^3.0.1",
"react-native-web": "^0.13.18",
"react-native-webview": "11.2.3",
"react-navigation-header-buttons": "^7.0.1",
"react-redux": "^7.2.3",
"redux": "^4.0.5",
"redux-thunk": "^2.3.0"
},
"devDependencies": {
"#babel/core": "~7.9.0",
"#types/i18n-js": "^3.8.0",
"#types/react": "~16.9.35",
"#types/react-dom": "^17.0.3",
"#types/react-native": "~0.63.2",
"#types/react-redux": "^7.1.16",
"typescript": "~4.0.0"
},
"private": true
}
How can I make it working again?
UPDATE #1
I have created a new project and I have installed all dependencies by expo install without react-native-modal-datetime-picker. I have copied and dependencies to my original project. When I used npm install my project installed correctly with the message:
22:39 $ npm install
npm WARN deprecated deep-assign#3.0.0: Check out `lodash.merge` or `merge-options` instead.
npm WARN deprecated #hapi/topo#3.1.6: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated #hapi/bourne#1.3.2: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated #hapi/address#2.1.4: Moved to 'npm install #sideway/address'
npm WARN deprecated #hapi/hoek#8.5.1: This version has been deprecated and is no longer supported or maintained
npm WARN deprecated uglify-es#3.3.9: support for ECMAScript is superseded by `uglify-js` as of v3.13.0
npm WARN deprecated #hapi/joi#15.1.1: Switch to 'npm install joi'
npm WARN deprecated core-js#1.2.7: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
npm WARN deprecated core-js#2.6.12: core-js#<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js#3.
added 1087 packages, and audited 1088 packages in 30s
60 packages are looking for funding
run `npm fund` for details
12 low severity vulnerabilities
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
Right now I'm trying to install react-native-modal-datetime-picker (https://github.com/mmazzarolo/react-native-modal-datetime-picker) and I'm getting error:
22:44 $ expo install react-native-modal-datetime-picker #react-native-community/datetimepicker
Installing 1 SDK 41.0.0 compatible native module and 1 other package using npm.
> npm install
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: undefined#undefined
npm ERR! Found: react#16.13.1
npm ERR! node_modules/react
npm ERR! react#"16.13.1" from the root project
npm ERR! peer react#">=16.8.3" from #react-native-community/datetimepicker#3.2.0
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"3.2.0" from the root project
npm ERR! 1 more (react-native)
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer react#"17.0.1" from react-native-windows#0.64.3
npm ERR! node_modules/react-native-windows
npm ERR! peer react-native-windows#">=0.62" from #react-native-community/datetimepicker#3.2.0
npm ERR! node_modules/#react-native-community/datetimepicker
npm ERR! #react-native-community/datetimepicker#"3.2.0" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /home/adas/.npm/eresolve-report.txt for a full report.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/adas/.npm/_logs/2021-04-17T20_53_05_643Z-debug.log
npm exited with non-zero code: 1
Error: npm exited with non-zero code: 1
at ChildProcess.completionListener (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/spawn-async/src/spawnAsync.ts:65:13)
at Object.onceWrapper (events.js:422:26)
at ChildProcess.emit (events.js:315:20)
at ChildProcess.EventEmitter.emit (domain.js:467:12)
at maybeClose (internal/child_process.js:1048:16)
at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
...
at Object.spawnAsync [as default] (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/spawn-async/src/spawnAsync.ts:26:19)
at NpmPackageManager._runAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/package-manager/src/NodePackageManagers.ts:166:31)
at NpmPackageManager.addAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/node_modules/#expo/package-manager/src/NodePackageManagers.ts:105:18)
at installAsync (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/src/commands/install.ts:130:3)
at Command.<anonymous> (/home/adas/.nvm/versions/node/v14.16.0/lib/node_modules/expo-cli/src/exp.ts:349:7)
Try Updating packages to the latest version.
npm update
give a try to install with --force flag as well if the update has not worked. eg:
npm install --force
try running this:
npm install --legacy-peer-deps --global expo-cli

installing node dependencies manually

As I've learned from SO topics dependencies for node aren't installed automatically on the fly since npm version 3. I'm running version 3.5.2 and I get these warnings when running npm install --no-optional:
npm WARN eslint-config-react-app#5.0.2 requires a peer of #typescript-eslint/eslint-plugin#2.x but none was installed.
npm WARN eslint-config-react-app#5.0.2 requires a peer of #typescript-eslint/parser#2.x but none was installed.
npm WARN eslint-config-react-app#5.0.2 requires a peer of eslint#6.x but none was installed.
npm WARN ts-pnp#1.1.2 requires a peer of typescript#* but none was installed.
npm WARN tsutils#3.17.1 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev
npm ERR! Missing: react-router-dom#^5.1.2
npm ERR! Invalid: lock file's #typescript-eslint/eslint-plugin#1.13.0 does not satisfy #typescript-eslint/eslint-plugin#2.8.0
npm ERR!
How do I install these manually ?
I tried:
npm install #typescript-eslint/eslint-plugin#2.*
npm install eslint#6.*
npm install typescript#*
but that did no good. Still throws those warnings.
I got little bit further:
npm ERR! code ETARGET
npm ERR! notarget No matching version found for #typescript-eslint/eslint-plugin#^5.16.0.
npm ERR! notarget In most cases you or one of your dependencies are requesting
npm ERR! notarget a package version that doesn't exist.
npm ERR! notarget
npm ERR! notarget It was specified as a dependency of 'client'
npm ERR! notarget
npm ERR! A complete log of this run can be found in:
npm ERR! /home/mark/.npm/_logs/2019-10-04T20_26_24_111Z-debug.log
Please use the following for each peer dependency to install that and remove the error.
$ npm install --save-dev #typescript-eslint
For another error,
No matching version found for #typescript-eslint/eslint-plugin#^5.16.0.
Please run npm view #typescript-eslint/eslint-plugin.
Then, you can see that highest version of #typescript-eslint/eslint-plugin is 2.3.2 now. This #typescript-eslint/eslint-plugin#^5.16.0 version not exists.

Grunt won't install on my project

I've been trying to install grunt on my project but no luck.
Here's the error i get when running npm install
npm WARN package.json XXX#1.0.0 No license field.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v0.12.7
npm ERR! npm v2.11.3
npm ERR! code EPEERINVALID
npm ERR! peerinvalid The package grunt does not satisfy its siblings' peerDependencies requirements!
npm ERR! peerinvalid Peer grunt-contrib-copy#0.8.2 wants grunt#>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-sass#0.9.2 wants grunt#>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch#0.6.1 wants grunt#~0.4.0
npm ERR! peerinvalid Peer grunt-mustache-render#1.9.0 wants grunt#^0.4.5
Heres' what my package json looks like
{
"name": "XXX",
"version": "1.0.0",
"repository": {
"type": "git",
"url": "some git repo"
},
"devDependencies": {
"grunt-html-build": "^0.5.1",
"grunt-contrib-copy": "^0.8.0",
"grunt-contrib-sass": "^0.9.2",
"grunt-contrib-watch": "^0.6.1",
"grunt-mustache-render": "^1.9.0"
}
}
I've tried npm update -g but nothing much seems to happen.
npm --version says 2.11.3
the only relevant error i think i found was when i ran
> npm list
├─┬ grunt#1.0.1 peer invalid
and at the end: npm ERR! peer invalid: grunt#1.0.1
> grunt --version
grunt-cli v1.2.0
grunt v1.0.1
do i need to re-install grunt or something ? I haven't found a command for that.
Thanks for your help!
Some grunt-plugins haven't updated their peer dependency requirements yet to work with the 1.0 version of grunt (1.0 is fairly new). You can try to remove the peer dependency requirements, but that could be problematic depending on what changes were made between 0.4.5 and 1.0. (0.4.5 was the last version prior to 1.0)
Try installing the version of grunt that's compatible with the plugins first: npm install grunt#^0.4.5 --save-dev
For npm version 2, you should have grunt version 0.4.5
"devDependencies": {
"grunt": "^0.4.5" }
As you seen below , npm version is less than 3 so you should have grunt version: ^0.4.5
$ npm --version
2.15.11
Output from npm install explains everything pretty good:
npm ERR! peerinvalid Peer grunt-contrib-copy#0.8.2 wants grunt#>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-sass#0.9.2 wants grunt#>=0.4.0
npm ERR! peerinvalid Peer grunt-contrib-watch#0.6.1 wants grunt#~0.4.0
npm ERR! peerinvalid Peer grunt-mustache-render#1.9.0 wants grunt#^0.4.5
To understand it you need to understand semantical versioning explained here:
https://docs.npmjs.com/files/package.json#version
and here
https://docs.npmjs.com/misc/semver
In order to fix the problem you must specify more flexible version number for packages that block installation of new grunt.
Just set ">= 0.0.0" requirement for all grunt plugins and their versions will be synchronized with grunt version by npm.
"devDependencies": {
"grunt-html-build": ">=0.0.0",
"grunt-contrib-copy": ">=0.0.0",
"grunt-contrib-sass": ">=0.0.0",
"grunt-contrib-watch": ">=0.0.0",
"grunt-mustache-render": ">=0.0.0"
}

Jhispter installation: The package karma does not satisfy its siblings' peerDependencies requirements

I'm trying to generete jhipster project by yo. But when I run it, a strange error occurs: The package karma does not satisfy its siblings' peerDependencies requirements!
I uninstalled the nodejs completely and installed it again, but still same error.
When I search for there are some solution advices like this or this.
I have 64 bit win7,
node -v v0.10.26
npm -v 1.4.3
error peerinvalid The package karma does not satisfy its siblings' peerDependencies requirements!
error peerinvalid Peer karma-script-launcher#0.1.0 wants karma#>=0.9
error peerinvalid Peer karma-chrome-launcher#0.1.2 wants karma#>=0.9.3
error peerinvalid Peer karma-html2js-preprocessor#0.1.0 wants karma#>=0.9
error peerinvalid Peer karma-jasmine#0.1.5 wants karma#>=0.9
error peerinvalid Peer karma-requirejs#0.2.1 wants karma#>=0.9
error peerinvalid Peer karma-phantomjs-launcher#0.1.2 wants karma#>=0.9
error peerinvalid Peer grunt-karma#0.7.3 wants karma#~0.12.0
error System Windows_NT 6.1.7601
error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
error cwd C:\Users\EXT0182703\LuckyShoot
error node -v v0.10.26
error npm -v 1.4.3
error code EPEERINVALID
verbose exit [ 1, true ]
I had a similar issue and I did this in terminal:
rm -rf /usr/local/lib/node_modules/karma-*
and then updated the package.json:
"devDependencies": {
"karma": "0.12.0",
...
}
then reinstall
sudo npm install karma
It worked for me
We released yesterday the version 0.11 that fixes this problem.
Try it. http://jhipster.github.io/2014/02/19/jhipster-release-0.11.0.html