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"
}
Related
I am trying to install material UI as described on the home page, but I get a dependency tree error :
C:\dev\shape-shop-front-end>npm install #mui/material
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: my-app#0.1.0
npm ERR! Found: react#16.14.0
npm ERR! node_modules/react
npm ERR! react#"^16.13.1" from the root project
npm ERR! peer react#">=16.8.0" from #emotion/react#11.7.1
npm ERR! node_modules/#emotion/react
npm ERR! node_modules/#mui/material
npm ERR! #mui/material#"*" from the root project
npm ERR!
In my package.json I have "react": "^16.13.1" .
As I understand it, this error is saying that a MUI package needs react 16.8.0
Indeed, a sub-dependency of it, named #emotion/react#11.7.1, has listed the following peer dependencies you have to meet:
"peerDependencies": {
"#babel/core": "^7.0.0",
"react": ">=16.8.0"
}
source: https://github.com/emotion-js/emotion/blob/main/packages/react/package.json
I think this has to do with how new versions of NPM deal with peer dependencies: https://github.blog/2021-02-02-npm-7-is-now-generally-available/
As your react version seems OK, I would go with this suggestion:
You have the option to retry with --force to bypass the conflict or --legacy-peer-deps command to ignore peer dependencies entirely (this behavior is similar to versions 4-6).
Try using --force.
That's what worked for me
npm install #mui/material --force
I have a feeling it's a dependency conflict that came with the recent React upgrade...
Looks like updating dependencies in package.json is the only way to make this happen now.
$ npm install -g npm-check-updates
$ ncu -u
$ npm install
or see how to update each dependency in package.json
after updating, now try to install your material UI.
use this command instead
npm install #material-ui/core
If you're using it for the icon, then use this
npm install #material-ui/core #material-ui/icons
Try using
npm install #material-ui/core --force
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
If I run the npm install even with root permission, the following package.json from jsreport will fail with mkdir permission error from phamtom-pdf related packages
{
"name": "jsreport-server",
"main": "server.js",
"scripts": {
"start": "node server",
"jsreport": "jsreport"
},
"jsreport": {
"entryPoint": "server.js"
},
"dependencies": {
"jsreport": "2.3.0",
"jsreport-phantom-pdf": "^2.1.4"
}
}
Remove the jsreport-phantom-pdf dependency and install it manually later is fine but it seemed weird and defeat the purpose of package.json.
--------Edit-------
npm WARN deprecated npmconf#2.1.1: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated npmconf#2.0.9: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated graceful-fs#3.0.11: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated node-uuid#1.4.8: Use uuid module instead
npm WARN deprecated hoek#0.9.1: The major version is no longer supported. Please update to 4.x or newer
> phantomjs#1.9.15 install /home/chnn/jsreport_git/node_modules/phantom-workers/node_modules/phantomjs
> node install.js
invalid config loglevel="notice"
/home/chnn/jsreport_git/node_modules/phantom-workers/node_modules/phantomjs/phantomjs is not writable: EACCES: permission denied, mkdir '/home/chnn/jsreport_git/node_modules/phantom-workers/node_modules/phantomjs/phantomjs'
Download already available at /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2
Extracting tar contents (via spawned process)
Removing /home/chnn/jsreport_git/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-1.9.8-linux-x86_64.tar.bz2-extract-1547027030055/phantomjs-1.9.8-linux-x86_64 -> /home/chnn/jsreport_git/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /home/chnn/jsreport_git/node_modules/phantom-workers/node_modules/phantomjs/lib/phantom/bin/phantomjs
> puppeteer#1.11.0 install /home/chnn/jsreport_git/node_modules/puppeteer
> node install.js
ERROR: Failed to download Chromium r609904! Set "PUPPETEER_SKIP_CHROMIUM_DOWNLOAD" env variable to skip download.
{ Error: EACCES: permission denied, mkdir '/home/chnn/jsreport_git/node_modules/puppeteer/.local-chromium'
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path: '/home/chnn/jsreport_git/node_modules/puppeteer/.local-chromium' }
npm WARN jsreport-server# No description
npm WARN jsreport-server# No repository field.
npm WARN jsreport-server# No license field.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#1.11.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#1.11.0 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/chnn/.npm/_logs/2019-01-09T09_43_52_509Z-debug.log
This is a known bug with the installer of puppeteer, see issue#367 and issue #375
You can try the workaround as mentioned by BennySLO
sudo npm install puppeteer --unsafe-perm=true
sudo chown -R <username> node_modules/
I recently received website that consists of an index.html, sass files, javascript files and a few configuration files. I tried to run the command npm install in the main project directory and I got the following error.
npm ERR! Error: No compatible version found: grunt-contrib-concat#'node_modules/grunt-contrib-concat'
npm ERR! Valid install targets:
npm ERR! ["0.1.0","0.1.1","0.1.2","0.1.3","0.2.0","0.3.0","0.4.0","0.5.0","0.5.1","1.0.0","1.0.1","0.1.2-rc5","0.1.2-rc6"]
npm ERR! at installTargetsError (/usr/share/npm/lib/cache.js:719:10)
npm ERR! at /usr/share/npm/lib/cache.js:638:10
npm ERR! at saved (/usr/share/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /usr/lib/nodejs/graceful-fs/polyfills.js:133:7
npm ERR! at Object.oncomplete (fs.js:107:15)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-#googlegroups.com>
npm ERR! System Linux 4.4.0-x86_64-linode63
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install"
npm ERR! cwd /var/www/project.com/public_html_staging
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /var/www/project.com/public_html_staging/npm-debug.log
npm ERR! not ok code 0
This is what my package.json looks like
{
"name": "project",
"version": "0.0.0",
"devDependencies": {
"glob": "~4.3.1",
"grunt": "~0.4.1",
"grunt-autoprefixer": "~2.0.0",
"grunt-concat-css": "^0.3.1",
"grunt-contrib-concat": "node_modules/grunt-contrib-concat",
"grunt-contrib-connect": "~0.9.0",
"grunt-contrib-cssmin": "~0.11.0",
"grunt-contrib-imagemin": "^1.0.0",
"grunt-contrib-jshint": "~0.10.0",
"grunt-contrib-sass": "~0.8.1",
"grunt-contrib-uglify": "~0.7.0",
"grunt-contrib-watch": "~0.6.1"
},
"dependencies": {
"load-grunt-tasks": "~2.0.0"
}
}
I'm really new to the npm command and any related subject matter. How do I begin to troubleshoot this error? Or does anyone know the solution?
The problem was caused by the fact that I was using NodeJS version 0.1 while the project was originally built on a server that had NodeJS v5. Hence the npm didn't have all the right grunt dependencies.
I did the following as root user on my affected server
apt-get purge nodejs
apt-get purge npm
apt-get autoremove // remove any orphan dependences
Once I got rid of everything, I install version 6 of NodeJS as per the nodejs website with these commands:
curl -sL https://deb.nodesource.com/setup_6.x | sudo -E bash -
sudo apt-get install -y nodejs
The NodeJS already came with it's own npm, so I didn't need to do anything else.
Then when I ran npm install, it properly downloaded all the necessary modules to run my project.
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