Error: Could not find expected browser (chrome) locally - npm

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!)

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.

Installing railway cli after running npm i -g #railway/cli i get errors

Iam trying to install railway cli
npm i -g #railway/cli
/home/isaac/.nvm/versions/node/v14.10.0/bin/railway -> /home/isaac/.nvm/versions/node/v14.10.0/lib/node_modules/#railway/cli/bin/railway.js
> #railway/cli#2.0.13 postinstall /home/isaac/.nvm/versions/node/v14.10.0/lib/node_modules/#railway/cli
> node ./npm-install/postinstall.js
internal/process/esm_loader.js:74
internalBinding('errors').triggerUncaughtException(
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'stream' imported from /home/isaac/.nvm/versions/node/v14.10.0/lib/node_modules/#railway/cli/npm-install/postinstall.js
at packageResolve (internal/modules/esm/resolve.js:624:9)
at moduleResolve (internal/modules/esm/resolve.js:665:18)
at Loader.defaultResolve [as _resolve] (internal/modules/esm/resolve.js:779:11)
at Loader.resolve (internal/modules/esm/loader.js:85:40)
at Loader.getModuleJob (internal/modules/esm/loader.js:229:28)
at ModuleWrap.<anonymous> (internal/modules/esm/module_job.js:51:40)
at link (internal/modules/esm/module_job.js:50:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
npm WARN notsup Unsupported engine for #railway/cli#2.0.13: wanted: {"node":">=16.0.0"} (current: {"node":"14.10.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: #railway/cli#2.0.13
npm WARN notsup Unsupported engine for node-fetch#3.3.0: wanted: {"node":"^12.20.0 || ^14.13.1 || >=16.0.0"} (current: {"node":"14.10.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: node-fetch#3.3.0
npm WARN notsup Unsupported engine for fetch-blob#3.2.0: wanted: {"node":"^12.20 || >= 14.13"} (current: {"node":"14.10.0","npm":"6.14.8"})
npm WARN notsup Not compatible with your version of node/npm: fetch-blob#3.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! #railway/cli#2.0.13 postinstall: `node ./npm-install/postinstall.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the #railway/cli#2.0.13 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/isaac/.npm/_logs/2022-12-06T07_16_56_179Z-debug.log
I get this error, i have tried everything but i cannot proceed
I have downgraded my node versions but still getting the same errors
Please update your node version to latest one. Refer this solution for same: https://askubuntu.com/a/480642. Then run hash -r to reset the location hash for bash.
Then simply run sudo npm i -g #railway/cli.

issues with installing react native, npm install -g expo-cli gives warnings

I'm trying to install Expo CLI to set up the development environment for React Native but I keep getting this warning when I enter "npm install -g expo-cli" into my terminal:
npm WARN EBADENGINE required: { node: '>=12 <=16' },
npm WARN EBADENGINE current: { node: 'v18.2.0', npm: '8.9.0' }
Previously, trying to install Expo CLI with npm would throw errors like
npm ERR! code EACCES
npm ERR! syscall rename
npm ERR! path /usr/local/lib/node_modules/expo-cli
npm ERR! dest /usr/local/lib/node_modules/.expo-cli-dKBr48UN
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'
npm ERR! [Error: EACCES: permission denied, rename '/usr/local/lib/node_modules/expo-cli' -> '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'rename',
npm ERR! path: '/usr/local/lib/node_modules/expo-cli',
npm ERR! dest: '/usr/local/lib/node_modules/.expo-cli-dKBr48UN'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
Then I tried the NVM solution in this post which asked me to uninstall node and then install NVM so that doing things like writing in my npm directory wouldn't ask for permission, but now I'm unsure what to do.
edit:
I followed this website to change my node version to v14.19.3 but now there are these warnings:
npm WARN deprecated subscriptions-transport-ws#0.9.8: The `subscriptions-transport-ws` package is no longer maintained. We recommend you use `graphql-ws` instead. For help migrating Apollo software to `graphql-ws`, see https://www.apollographql.com/docs/apollo-server/data/subscriptions/#switching-from-subscriptions-transport-ws For general help using `graphql-ws`, see https://github.com/enisdenjo/graphql-ws/blob/master/README.md
npm WARN deprecated graphql-tools#3.0.0: This package has been deprecated and now it only exports makeExecutableSchema.\nAnd it will no longer receive updates.\nWe recommend you to migrate to scoped packages such as #graphql-tools/schema, #graphql-tools/utils and etc.\nCheck out https://www.graphql-tools.com to learn what package you should use instead
npm WARN deprecated uuid#3.4.0: 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 svgo#1.3.2: This SVGO version is no longer supported. Upgrade to v2.x.x.
npm WARN deprecated source-map-resolve#0.5.3: See https://github.com/lydell/source-map-resolve#deprecated
npm WARN deprecated source-map-url#0.4.1: See https://github.com/lydell/source-map-url#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated querystring#0.2.0: The querystring API is considered Legacy. new code should use the URLSearchParams API instead.
npm WARN deprecated chokidar#2.1.8: Chokidar 2 does not receive security updates since 2019. Upgrade to chokidar 3 with 15x fewer dependencies
npm WARN deprecated fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
/Users/zoeylee/.nvm/versions/node/v14.19.3/bin/expo -> /Users/zoeylee/.nvm/versions/node/v14.19.3/lib/node_modules/expo-cli/bin/expo.js
/Users/zoeylee/.nvm/versions/node/v14.19.3/bin/expo-cli -> /Users/zoeylee/.nvm/versions/node/v14.19.3/lib/node_modules/expo-cli/bin/expo.js
npm WARN ajv-keywords#3.5.2 requires a peer of ajv#^6.9.1 but none is installed. You must install peer dependencies yourself.
I'm a new user and programmer so any advice/help is appreciated, thanks!
You are using 18.2.0, but the message says it requires >=12 <=16 (greater than 12 and less than 16. Not 18.2.0 or greater.
If it's your package.json with the engines field causing this issue, change it to say 12.0.0 or greater:
"engines": {
"node": ">=12.0.0"
},

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

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.

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