Unable to install serverless using atlassian/default-image - npm

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.

Related

GoCD - npm install failing

I am trying to set up a pipeline using GoCD. I have a requirement of running npm install and npm test, and so, I created a Pipeline with a single Stage, that has a single Job with two tasks.
When I execute the pipeline, the npm install task seems to fail with the error mentioned below. However, when I manually run npm install from the repository in the agent's folder, it goes through without errors. With GoCD's npm install, I found that almost all packages except 2 seem to be installed. It fails with the follow error, and I suspect this to be some problem with node-gyp.
...
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 (node_modules/glob-watcher/node_modules/fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.13 install: `node install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: spawn sh ENOENT
npm ERR! file sh
npm ERR! path sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn sh
npm ERR! node-expat#2.4.0 install: `node-gyp rebuild`
npm ERR! spawn sh ENOENT
npm ERR!
npm ERR! Failed at the node-expat#2.4.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:
...
I tried using Jenkins and found the same issue. After a lot of deep dives, I found that it had something to do with the Python version being used, which in turn is due to the Node version being used. I was using Node v12.4.0, and upgrading it to Node v14.x.x addressed my issue.

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

Couldn't install dependencies while setting up strapi project

npx create-strapi-app my-project --quickstart
I am executing this command and it is trying to download certain libraries from github using npm. Due to security reasons the servers are not allowed access to github, so it is not able to download libraries like libvips. Is there any other way to setup a strapi project so that it could get libraries from any other source ?
Here's the error snippet
npx: installed 91 in 18.847s
Creating a new Strapi application at /home/centos/my-project.
Creating a quickstart project.
Creating files.
Error while installing dependencies:
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated boom#7.3.0: This module has moved and is now available at #hapi/boom. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated #formatjs/intl-unified-numberformat#3.3.7: We have renamed the package to #formatjs/intl-numberformat
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated hoek#6.1.3: This module has moved and is now available at #hapi/hoek. Please update your dependencies as this version is no longer maintained an may contain bugs and security issues.
npm WARN deprecated core-js#2.6.11: 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 chokidar#2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated popper.js#1.16.1: You can find the new Popper v2 at #popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated mailcomposer#3.12.0: This project is unmaintained
npm WARN deprecated buildmail#3.10.0: This project is unmaintained
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 fsevents#1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
info sharp Downloading http://10.157.194.58/sharp/v8.10.0/libvips-8.10.0-linux-x64.tar.br
ERR! sharp tunneling socket could not be established, statusCode=403
info sharp Attempting to build from source via node-gyp but this may fail due to the above error
info sharp Please see https://sharp.pixelplumbing.com/install for required dependencies
../src/common.cc:24:22: fatal error: vips/vips8: No such file or directory
#include <vips/vips8>
^
compilation terminated.
make: *** [Release/obj.target/sharp/src/common.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/centos/node-v12.18.4-linux-x64/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 3.10.0-1127.18.2.el7.x86_64
gyp ERR! command "/home/centos/node-v12.18.4-linux-x64/bin/node" "/home/centos/node-v12.18.4-linux-x64/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/centos/my-project/node_modules/sharp
gyp ERR! node -v v12.18.4
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#~2.1.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN notsup Unsupported engine for watchpack-chokidar2#2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.18.4","npm":"6.14.6"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2#2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN strapi-connector-bookshelf#3.2.2 requires a peer of knex#^0.20.0 but none is installed. You must install peer dependencies yourself.
npm WARN #buffetjs/utils#3.3.1 requires a peer of yup#^0.27.0 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap#4.5.2 requires a peer of jquery#1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! sharp#0.26.0 install: `(node install/libvips && node install/dll-copy && prebuild-install) || (node-gyp rebuild && node install/dll-copy)`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the sharp#0.26.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/centos/.npm/_logs/2020-10-09T11_07_28_305Z-debug.log
Keep trying!
Oh, it seems that you encountered errors while installing dependencies in your project.
Don't give up, your project was created correctly.
Fix the issues mentionned in the installation errors and try to run the following command:
cd /home/centos/my-project && npm install
This helps for me.
Open MAC terminal and use these commands:
npm cache clean --force
npx create-strapi-app
npm i
npm run develop
I had the same problem, try here:
https://github.com/nodejs/node-gyp/blob/master/macOS_Catalina.md#Solutions
After, that still had problem with installation and deleted .npm/_libvips/libvips-8.10.0-darwin-x64.tar.br file and installed npx create-strapi-app my-project --quickstart everything was ok
i have problem in installing dependencies
my operation system is windows 11
tested with node v14 and v16
tested with npm v6 and v8
tested with yarn npx and npm
no one working
i just stuck in line bellow for hours
warning "#strapi/strapi > #strapi/admin > webpack-dev-server > http-proxy-middleware#2.0.2" has unmet peer dependency "#types/express#^4.17.13".
warning "#strapi/plugin-users-permissions > grant-koa#5.4.8" has unmet peer dependency "koa#>=2.0.0".
warning Workspaces can only be enabled in private projects.
[5/5] Building fresh packages...
[-/9] ⠠ waiting...
[-/9] ⠠ waiting...
[-/9] ⠠ waiting...
[4/9] ⠠ sharp
[-/9] ⠐ waiting...
What worked for me was as simple as adding a yarn.lock file to the root of your project and running yarn install and finally run yarn start, your project should start successfully
I know the thread is pretty old but I came across the same issue while trying to install Strapi on a Windows 10 local development enviroment using MySQL Database through npm, even though some of the posted answers in this thread helped me to get a better understanding of the issue for my specific case the solution was as follow:
In phpMyAdmin
Create a new MySQL DB Schema and user for the project, this will be the Database and User to be entered during the npx installation process
In Windows PowerShell (as admin)
npx create-strapi-app#latest my-project
cd my-project
npm install
npm run develop
These are the npm, node and MySQL version I used to install Strapi locally:
npm Vers. 6.14.17 check your version using npm -v
node.js Vers. 14.20.0 check your version using node -v
MySQL Vers. 10.4.24-MariaDB
Strapi should run by defult at http://localhost:1337/admin
To change the port it would be needed to edit the .env file at your project root directory.
I was having similar issues, tried a bunch of stuff. Ran this code in the terminal and it solved all of my issues:
sudo apt-get install build-essential apt-transport-https lsb-release ca-certificates curl -y

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