GoCD - npm install failing - npm

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.

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.

Troubleshooting npx create-strapi-app error

After running npx create-strapi-app#3 cartdb --quickstart I get a list of errors posted below:
Creating a quickstart project.
Creating files.
- Installing dependencies:
Error while installing dependencies:
npm WARN config production Use `--omit=dev` instead.
npm WARN config optional Use `--omit=optional` to exclude optional dependencies, or
npm WARN config `--include=optional` to include them.
npm WARN config
npm WARN config Default value does install optional deps unless otherwise omitted.
npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR!
npm ERR! While resolving: cartdb#0.1.0
npm ERR! Found: knex#0.19.5
npm ERR! node_modules/knex
npm ERR! knex#"<0.20.0" from the root project
npm ERR!
npm ERR! Could not resolve dependency:
npm ERR! peer knex#"^0.20.0" from strapi-connector-bookshelf#3.1.4
npm ERR! node_modules/strapi-connector-bookshelf
npm ERR! strapi-connector-bookshelf#"3.1.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.
npm ERR!
Keep trying!
I've updated npm and node but still encounter this error. I'm still at a lost after reading through the strapi documentation and some other answers on stackoverflow

React native create new app issue - npm exited with non-zero code: 1

expo init test111
? Choose a template: expo-template-tabs
Using npm to install packages. You can pass --yarn to use Yarn instead.
Extracting project files...
Customizing project...
Unable to initialize git repo. git not in PATH.
Installing dependencies...
npm install
npm WARN deprecated deep-assign#3.0.0: Check out lodash.merge or merge-options instead.
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 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 left-pad#1.3.0: use String.prototype.padStart()
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ENOENT
npm ERR! syscall spawn git
npm ERR! path git
npm ERR! errno ENOENT
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t https://github.com/naver/hammer.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
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! C:\Users\mkame\AppData\Roaming\npm-cache_logs\2020-02-16T22_14_16_693Z-debug.log
npm exited with non-zero code: 1
Set EXPO_DEBUG=true in your env to view the stack trace.
rm -rf node_modules/
npm install
Try removing node modules and reinstall it. This worked for me.

Nuxt.js: fsevents is not a constructor

I'm using MacOS Mojave 10.14.5. When I run 'npm run dev' command where the nuxt starter package is located, I have 'fsevents' error, and the server doesn't work.
I already reinstall node and npm several times, but it doesn't work.
Here's an error:
/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:28
return (new fsevents(path)).on('fsevent', callback).start();
^
TypeError: fsevents is not a constructor
at createFSEventsInstance (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:28:11)
at setFSEventsListener (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:82:16)
at FSWatcher.FsEventsHandler._watchWithFsEvents (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:252:16)
at FSWatcher.<anonymous> (/Users/kimgyun/Desktop/nuxt_test_folder/nuxt_test_b/node_modules/watchpack/node_modules/chokidar/lib/fsevents-handler.js:386:25)
at LOOP (fs.js:1570:14)
at process._tickCallback (internal/process/next_tick.js:61:11)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! nuxt_test_b#1.0.0 dev: `nuxt`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the nuxt_test_b#1.0.0 dev 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/kimgyun/.npm/_logs/2019-06-06T02_11_18_374Z-debug.log
How can I run this nuxt.js server without this error?
It's a problem with fs events, and a rather annoying one at that. Specifically this happens when you're using Node 12.
You'll need to install fsevents#1.2.9 explicitly:
npm i fsevents#1.2.9 -D
or
yarn add fsevents#1.2.9 -D
This should work for you at this point.

PolymerCLI - Error : Run the command "npm install -g polymer-cli-1.5.7.tgz"

Following the steps:
install polymer-cli
Run the command : npm install polymer-cli
After install the bundled-debs :
Run the command : npm install -g bundle-deps
After run the command :
bundle-deps
Finally run the command :
npm pack
Got the polymer-cli-1.5.7.tgz file.
Now, run the npm install command,
npm install -g polymer-cli-1.5.7.tgz
Result :
Get the error message :
```
C:\Users\*****\AppData\Roaming\npm
`-- (empty)
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#^1.0.0 (node_modules\polymer-cli\node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"ia32"})
npm WARN sinon-chai#2.14.0 requires a peer of chai#>=1.9.2 <5 but none was installed.
npm WARN sinon-chai#2.14.0 requires a peer of sinon#^1.4.0 || ^2.1.0 || ^3.0.0 || ^4.0.0 but none was installed.
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\\Program Files (x86)\\nodejs\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "polymer-cli-1.5.7.tgz"
npm ERR! node v6.11.5
npm ERR! npm v3.10.10
npm ERR! path C:\Users\*****\AppData\Roaming\npm\node_modules\.staging\#polymer\sinonjs-1e1235f0
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\*****\AppData\Roaming\npm\node_modules\.staging\#polymer\sinonjs-1e1235f0' -> 'C:\Users\*****\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\#polymer\sinonjs'
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\Users\*****\AppData\Roaming\npm\node_modules\.staging\#polymer\sinonjs-1e1235f0' -> 'C:\Users\*****\AppData\Roaming\npm\node_modules\polymer-cli\node_modules\#polymer\sinonjs'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! C:\nginx-1.13.7\html\polymer-cli\npm-debug.log
npm ERR! code 1
```
Note:
****** - User Name
Versions & Environment
- Polymer CLI: 1.5.7
- node: v.6.11.5
- Operating System: windows
I am not sure why are you installing polymer-cli-1.5.7.tgz when you installed polymer-cli already in the first step? But not globally, you are missing -g switch in first step. What are you trying to achieve, which procedure do you follow? The issue could be related to permissions because you don't have rights to access that path, but you could try running console with administrator privileges. It is better to explain what exactly you want to setup so we can give you a better answer :)