No compatible version found: grunt-contrib-concat#'node_modules/grunt-contrib-concat' - npm

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.

Related

HEROKU: Logging in with another Heroku accnt and deploying fails my build

UPDATE:
I removed the warning by switching bcrypt versions V3 with V1.03. BUT now my passwords don't work. I assume it's because of the different hashing between both versions.
I created a personal Heroku account and uploaded my MERN project without a problem. I then created a 2nd Heroku accnt for work.
I then heroku logout and heroku login with the new account. I then tried uploading the same project with no changes, but keep getting
bcrypt#3.0.2 install /tmp/build_c823e78c1ca132209f395f59cc6e1071/node_modules/bcrypt
node-pre-gyp install --fallback-to-build
// lots of node-pre-gyp ERR! code before finishing with
gyp ERR! cwd /tmp/build_c823e78c1ca132209f395f59cc6e1071/node_modules/bcrypt
gyp ERR! node -v v8.12.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.2 install: `node-pre-gyp install --fallback-to-build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.2 install script.
Node v8.12.0
NPM 6.4.1
Git version 2.17.1 (Apple Git-112)
macOS Mojave V 10.14
I use bcrypt 3.0.2 and ran into a similar issue today. Locally I am using Node version 10.11.0, but because I haven't specified it in the package.json, Heroku took a default Node version 8.XX.XX. I set it explicitly for Heroku as the same version as I use locally in my package.json file and then it worked.
{
"name": "my-app",
"version": "1.0.0",
"description": "",
"engines": {
"node": "10.11.0"
},
"scripts": {
...

`no such file or directory` While installing js beautify in npm

I get this error when i use npm -g install js-beautify
npm ERR! path /home/developer/software/nodejs/lib/node_modules/js-
beautify/js/bin/css-beautify.js
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall chmod
npm ERR! enoent ENOENT: no such file or directory, chmod
'/home/developer/software/nodejs/lib/node_modules/js-
beautify/js/bin/css-beautify.js'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/developer/.npm/_logs/2017-09-18T07_52_38_910Z-
debug.log
What can be done to solve this?
I am using node 8.5.0 an npm 5.3.0
JS-Beautify 1.7.0 is broken.
Explicitly install the last good version:
npm -g install js-beautify#1.6.14
… or wait for a fixed version to be released.
The fix for me was to add to package.json:
"devDependencies": {
"js-beautify": "1.6.14",
and
"resolutions": {
"js-beautify": "1.6.14"
}
then delete the node_modules/ directory
and finaly reinstall all of the dependencies using npm install (for some reason yarn would fail - even after deleting yarn.lock)

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"
}

ElectronJs: Not able to install "install.js:22 throw err"

I am starting with Electron js and I have stumbled on the very first step which is installed Electron.
I am running the following command to install electron provided at
source
npm install electron-prebuilt --save-dev
Following is the result of the command
C:\Users\vikas\Desktop\electron apps\example>npm install electron-prebuilt --sa
ve-dev
electron-prebuilt#0.37.8 postinstall C:\Users\vikas\Desktop\electron apps\exa
mple\node_modules\electron-prebuilt
node install.js
C:\Users\vikas\Desktop\electron apps\example\node_modules\electron-prebuilt\ins
tall.js:22
throw err
^
Error: end of central directory record signature not found
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:167:14
at C:\Users\vikas\Desktop\electron apps\example\node_modules\yauzl\index.js
:473:5
at C:\Users\vikas\Desktop\electron apps\example\node_modules\fd-slicer\inde
x.js:32:7
at FSReqWrap.wrapper as oncomplete
npm WARN enoent ENOENT: no such file or directory, open 'C:\Users\vikas\Desktop
\electron apps\example\package.json'
npm WARN example No description
npm WARN example No repository field.
npm WARN example No README data
npm WARN example No license field.
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Users\vikas\AppData\
\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "electron-prebuilt"
"--save-dev"
npm ERR! node v4.4.3
npm ERR! npm v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! electron-prebuilt#0.37.8 postinstall: node install.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the electron-prebuilt#0.37.8 postinstall script 'node install
.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the electron-prebuilt pac
kage,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node install.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs electron-prebuilt
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls electron-prebuilt
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\vikas\Desktop\electron apps\example\npm-debug.log
Windows 8.1
NPM Version 3.8.9
Does C:\Users\vikas\Desktop\electron apps\example\package.json exist? If not try running npm init to create it, and then run npm install electron-prebuilt --save-dev again.
this is bug and a workaround is provided on github : Source
Here is the workaround:
rm -rf ~/.electron/
rm -rf ~/.atom/
npm cache clear
npm install
I was facing a similar issue. But opening the command prompt as administrator (Windows) and reinstalling electron fixed the issue.

NPM install express. Error: No compatible version found

My OS is Ubuntu 13.04, 32 bit.
I am trying to install express with this command:
$ npm install express
And this is the error I get:
npm http GET https://registry.npmjs.org/express
npm http GET https://registry.npmjs.org/express
npm http 304 https://registry.npmjs.org/express
npm ERR! Error: No compatible version found: express#'>=4.0.0-0'
npm ERR! Valid install targets:
npm ERR! ["0.14.0","0.14.1","1.0.0","1.0.1","1.0.2","1.0.3","1.0.4","1.0.5","1.0.6","1.0.7","1.0.8","2.0.0","2.1.0","2.1.1","2.2.0","2.2.1","2.2.2","2.3.0","2.3.1","2.3.2","2.3.3","2.3.4","2.3.5","2.3.6","2.3.7","2.3.8","2.3.9","2.3.10","2.3.11","2.3.12","2.4.0","2.4.1","2.4.2","2.4.3","2.4.4","2.4.5","2.4.6","2.4.7","2.5.0","2.5.1","2.5.2","2.5.3","2.5.4","2.5.5","2.5.6","2.5.7","2.5.8","2.5.9","2.5.10","2.5.11","3.0.0","3.0.1","3.0.2","3.0.3","3.0.4","3.0.5","3.0.6","3.1.0","3.1.1","3.1.2","3.2.0","3.2.1","3.2.2","3.2.3","3.2.4","3.2.5","3.2.6","3.3.0","3.3.1","3.3.2","3.3.3","3.3.4","3.3.5","3.3.6","1.0.0-beta","1.0.0-beta2","1.0.0-rc","1.0.0-rc2","1.0.0-rc3","1.0.0-rc4","2.0.0-beta","2.0.0-beta2","2.0.0-beta3","2.0.0-rc","2.0.0-rc2","2.0.0-rc3","3.0.0-alpha1","3.0.0-alpha2","3.0.0-alpha3","3.0.0-alpha4","3.0.0-alpha5","3.0.0-beta1","3.0.0-beta2","3.0.0-beta3","3.0.0-beta4","3.0.0-beta6","3.0.0-beta7","3.0.0-rc1","3.0.0-rc2","3.0.0-rc3","3.0.0-rc4","3.0.0-rc5","3.3.7"]
npm ERR! at installTargetsError (/home/admin/.nodes/0.10.17/lib/node_modules/npm/lib/cache.js:719:10)
npm ERR! at next (/home/admin/.nodes/0.10.17/lib/node_modules/npm/lib/cache.js:698:17)
npm ERR! at /home/admin/.nodes/0.10.17/lib/node_modules/npm/lib/cache.js:675:5
npm ERR! at saved (/home/admin/.nodes/0.10.17/lib/node_modules/npm/node_modules/npm-registry-client/lib/get.js:142:7)
npm ERR! at /home/admin/.nodes/0.10.17/lib/node_modules/npm/node_modules/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 3.8.0-29-generic
npm ERR! command "/home/admin/.nodes/current/bin/node" "/home/admin/.nodes/current/bin/npm" "install" "express"
npm ERR! cwd /home/admin/M101JS/Week 2/hw2/hw2-3/blog
npm ERR! node -v v0.10.17
npm ERR! npm -v 1.3.8
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/admin/M101JS/Week 2/hw2/hw2-3/blog/npm-debug.log
npm ERR! not ok code 0
I am new to NodeJS and NPM, so I don't understand the response.
Does anyone have an idea how I can fix it?
You want to run the latest node (currently 0.10.22). Try these steps to get the newest version:
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs -y # newer nodejs package includes npm
And then try again on npm install express.
Update your npm
npm install -g npm
This was a bug in an earlier version of npm: https://github.com/npm/npm/issues/4984
You may get warnings when you update. Run the update one more time and you should see a clean npm install.
While the solution by #Jim worked well, if you feel the need to update NodeJS, you can do so via the n package:
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
If you are sitting in corporate network then worth pointing registry to your corporate registry/artifactory and trying.
npm config set registry