npm install vercel fails for wrong node version though it is correct - npm

I am trying to install the Vercel package:
$ sudo npm i -g vercel
> vercel#19.2.0 preinstall /usr/local/lib/node_modules/vercel
> node ./scripts/preinstall.js
> Error! Detected unsupported Node.js version.
Expected ">= 10" but found "8.10.0".
Please update to the latest Node.js LTS version to install Vercel CLI.
npm WARN notsup Unsupported engine for vercel#19.2.0: wanted: {"node":">= 10"} (current: {"node":"8.10.0","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: vercel#19.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! vercel#19.2.0 preinstall: `node ./scripts/preinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vercel#19.2.0 preinstall script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
It claims my node version is not above v10 but when I do the following it shows:
$ node -v
v12.18.2
And npm:
$ npm -v
6.14.6
So who is lying? ;) Whats the issue?

I suggest you check if that version is the default with nvm list.
For more info on setting the default version, check this question.

Related

Unable to install serverless using atlassian/default-image

I have a serverless application and I'm trying to use Bitbucket pipeline to create a build,
I'm using atlassian/default-image:3 image for the Pipeline image,
It comes pre installed with node and few other useful libraries.
The pre installed Node and npm versions are as follows -
Node - v14.17.5
npm - 6.14.14
While trying to install serverless using the command -
npm install -g serverless
I'm getting the following error -
npm WARN deprecated querystring#0.2.1: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated superagent#7.1.6: Please downgrade to v7.1.5 if you need IE/ActiveXObject support OR upgrade to v8.0.0 as we no longer support IE and published an incorrect patch version (see https://github.com/visionmedia/superagent/issues/1731)
/root/.nvm/versions/node/v14.17.5/bin/serverless -> /root/.nvm/versions/node/v14.17.5/lib/node_modules/serverless/bin/serverless.js
/root/.nvm/versions/node/v14.17.5/bin/sls -> /root/.nvm/versions/node/v14.17.5/lib/node_modules/serverless/bin/serverless.js
> es5-ext#0.10.62 postinstall /root/.nvm/versions/node/v14.17.5/lib/node_modules/serverless/node_modules/es5-ext
> node -e "try{require('./_postinstall')}catch(e){}" || exit 0
sh: 1: node: Permission denied
> serverless#3.25.1 postinstall /root/.nvm/versions/node/v14.17.5/lib/node_modules/serverless
> node ./scripts/postinstall.js
sh: 1: node: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.3.2 (node_modules/serverless/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.3.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! serverless#3.25.1 postinstall: `node ./scripts/postinstall.js`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the serverless#3.25.1 postinstall 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! /root/.npm/_logs/2022-12-14T06_11_03_877Z-debug.log
Check node version being used (node --version). I use nvm and was currently switched to an older vesion of node and got same error. After installing and switching to node v19.3.0 (latest at time of posting) the nom install serverless worked.

Error: Could not find expected browser (chrome) locally

I am trying to install aws-azure-login. I have to follow with Linux -> Option B: Install Only for Current User.
Then I ran this command:
sudo npm install -g aws-azure-login
I've got this output here:
GGNXFB3:~$ sudo npm install -g aws-azure-login
npm WARN deprecated uuid#3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
/usr/local/bin/aws-azure-login -> /usr/local/lib/node_modules/aws-azure-login/lib/index.js
> puppeteer#10.2.0 install /usr/local/lib/node_modules/aws-azure-login/node_modules/puppeteer
> node install.js
ERROR: Failed to set up Chromium r901912! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
{ [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/aws-azure-login/node_modules/puppeteer/.local-chromium']
errno: -13,
code: 'EACCES',
syscall: 'mkdir',
path:
'/usr/local/lib/node_modules/aws-azure-login/node_modules/puppeteer/.local-chromium' }
npm WARN notsup Unsupported engine for aws-azure-login#3.4.0: wanted: {"node":">=12.0"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: aws-azure-login#3.4.0
npm WARN notsup Unsupported engine for commander#8.1.0: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: commander#8.1.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#10.2.0 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#10.2.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! /root/.npm/_logs/2021-08-18T00_37_04_178Z-debug.log
GGNXFB3:~$
Anyone has had success with this?
You need to make sure about the following things first:
Upgrade your Node.Js from 10.19.0 to >=12.0
Check if you have done the puppeteer dependency installation before npm installing aws-azure-login.
The list of required packages is listed here on puppeteer's Troubleshooting document per Linux system (Debian or CentOS). E.g.:
sudo apt-get install gconf-service libasound2 libatk1.0-0 libatk-bridge2.0-0 ...
(But make sure you add all the relevant packages!)

Cannot install firebase CLI with npm

When I try to install firebase-tools with:
npm install -g firebase-tools
I get the following error:
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated mkdirp#0.5.4: Legacy versions of mkdirp are no longer supported. Please update to mkdirp 1.x. (Note that the API surface has changed to use Promises in 1.x.)
/usr/local/bin/firebase -> /usr/local/lib/node_modules/firebase-tools/lib/bin/firebase.js
npm WARN lifecycle The node binary used for scripts is /snap/bin/node but npm is using /snap/node/2609/bin/node itself. Use the `--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.
> protobufjs#6.8.9 postinstall /usr/local/lib/node_modules/firebase-tools/node_modules/protobufjs
> node scripts/postinstall
2020/03/31 16:23:53.220338 cmd_run.go:884: WARNING: cannot create user data directory: cannot create "/nonexistent/snap/node/2609": mkdir /nonexistent: permission denied
cannot create user data directory: /nonexistent/snap/node/2609: Permission denied
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules/firebase-tools/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! protobufjs#6.8.9 postinstall: `node scripts/postinstall`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the protobufjs#6.8.9 postinstall 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/david/.npm/_logs/2020-03-31T21_23_53_670Z-debug.log
I have googled this error but haven't found anything related. What can I do to install firebase-tools?
Reason: You used used snap to install node and snap does not allows apps to write to /usr/local and this is where all the global packages are installed.
What you can do to fix this?
snap remove node - uninstall the snap version of node
sudo apt-get install nodejs - install nodejs
npm install -g firebase-tools - this should work now
i had the same problem but i fixed it by not installing it globally
try this
npm install firebase-tools
or
sudo npm install -g firebase-tools

When installing Expo, I get 'permission denied' errors

When i try to install the Expo SDK, I get permission errors:
sudo npm install exp --global
> #expo/traveling-fastlane-darwin#1.2.5 preinstall /usr/local/lib/node_modules/exp/node_modules/#expo/traveling-fastlane-darwin
> node platform.js
/usr/local/bin/exp -> /usr/local/lib/node_modules/exp/bin/exp.js
> spawn-sync#1.0.15 postinstall /usr/local/lib/node_modules/exp/node_modules/spawn-sync
> node postinstall
> #expo/ngrok#2.3.0 postinstall /usr/local/lib/node_modules/exp/node_modules/#expo/ngrok
> node ./postinstall.js
ngrok - error unpacking binary { Error: EACCES: permission denied, open '/usr/local/lib/node_modules/exp/node_modules/#expo/ngrok/bin/ngrok'
errno: -13,
code: 'EACCES',
syscall: 'open',
path: '/usr/local/lib/node_modules/exp/node_modules/#expo/ngrok/bin/ngrok' }
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: #expo/traveling-fastlane-linux#1.2.5 (node_modules/exp/node_modules/#expo/traveling-fastlane-linux):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for #expo/traveling-fastlane-linux#1.2.5: wanted {"os":"win32,linux","arch":"any"} (current: {"os":"darwin","arch":"x64"})
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #expo/ngrok#2.3.0 postinstall: `node ./postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #expo/ngrok#2.3.0 postinstall 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! /Users/chris/.npm/_logs/2018-01-27T10_59_33_236Z-debug.log
I'm using npm 5.5.1 + node v8.9.1 + macOS high sierra
You really shouldn't be using sudo with npm at all. I would say please fix your permissions or as a more immediate solution, npm install --dev exp, so it becomes a devDependency to your project.
This command works for me sudo snap install ngrok
This worked for me:
sudo npm install --unsafe-perm -g expo-cli

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