NPM error while building Elixir/Phoenix code using Gitlab CI Pipe - npm

We are building and deploying our Elixir/Phoenix code using Gitlab CI pipe.
Everything was working perfectly fine but today our build log started throwing npm errors and not being able to build the code further
Getting below error in our build logs
#21 1.039 npm ERR! dot-prop not accessible from stylehacks:postcss-selector-parser
852#21 1.044
853#21 1.044 npm ERR! A complete log of this run can be found in:
854#21 1.045 npm ERR! /root/.npm/_logs/2021-12-18T00_00_39_802Z-debug.log
855#21 ERROR: executor failed running [/bin/sh -c npm --prefix ./assets ci --progress=false --no-audit --loglevel=error]: exit code: 1
856------
857 > [build 12/17] RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error:
858------
859executor failed running [/bin/sh -c npm --prefix ./assets ci --progress=false --no-audit --loglevel=error]: exit code: 1
860
Cleaning up file based variables
00:01
861ERROR: Job failed: exit code 1
We even tried updating our postcss package but no luck
Any help or pointers is much appreciated.

Able to fix the build issue by modifying the command for npm
Changed code line
From
RUN npm --prefix ./assets ci --progress=false --no-audit --loglevel=error
to
RUN npm --prefix ./assets install --progress=false --no-audit --loglevel=error

Related

error while installing npm error for version

I am trying to install npm to the code i am facing the below issue.
Command i try : npm install
or
npm -g install npm
npm cache clean -f
npm install -g n
below is the error:
sh: patch-package: command not found
npm ERR! code 127
npm ERR! path XXXX
npm ERR! command failed
npm ERR! command sh -c patch-package
If you're using yarn you can run yarn patch-package <args>
Otherwise ./node_modules/.bin/patch-package <args>
Or add ./node_modules/.bin to your $PATH environment variable (I prefer doing this)

Gatsby cloud deploy build error: bindings not accessible from webpack-dev-server:fsevents

I'm working on a Gatsby site. Currently I've got it building just fine locally, but when I try to deploy to Gatsby Cloud, it fails during "install project dependencies", with the Raw Logs showing this:
17:39:24 PM:
Cloning into '/usr/src/app/www'...
17:39:29 PM:
npm ERR! bindings not accessible from webpack-dev-server:fsevents
17:39:29 PM:
npm
17:39:29 PM:
ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-19T23_39_29_074Z-debug.log
17:39:29 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/
17:39:29 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit attempt 1 of 3...
17:39:31 PM:
npm
17:39:31 PM:
ERR! bindings not accessible from webpack-dev-server:fsevents
17:39:31 PM:
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-19T23_39_31_076Z-debug.log
17:39:31 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/
17:39:31 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ attempt 2 of 3...
17:39:33 PM:
npm
17:39:33 PM:
ERR! bindings not accessible from webpack-dev-server:fsevents
17:39:33 PM:
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-19T23_39_33_080Z-debug.log
17:39:33 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/
17:39:33 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ attempt 3 of 3...
17:39:35 PM:
npm
17:39:35 PM:
ERR! bindings not accessible from webpack-dev-server:fsevents
17:39:35 PM:
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-08-19T23_39_35_038Z-debug.log
17:39:35 PM:
NPM ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/ failure - Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/
17:39:35 PM:
ERROR Failed to compile: Error: Command failed with exit code 1 (EPERM): npm ci --unsafe-perm --prefer-offline --no-audit --registry=https://registry.npmjs.org/
I'm on a Linux (Ubuntu) OS.
Node version 14.16.0.
Even though the error doesn't seem to indicate that the build failed from fsevents not being present (rather that fsevent couldn't access 'bindings'--which is a term I'm pretty lost on, honestly), I did try installing fsevent locally, it failed (not surprisingly because it seems to be for MacOS). But I also tried manually placing it in either the dependencies and devDependencies of my package.json (my thought being that the cloud server would install it). That did not work either.
I'm pretty lost on this one, any help would be appreciated. I'm also not sure where I go to get the complete logs as referenced in the Raw Log above. I'll update if I find those so, if I haven't uploaded them yet, any help on where to go to get those would be appreciated.
Thanks
Assuming that the site builds locally as you said, the issue to me seems to be related to a mismatching of Node versions between environments (your local machine and Gatsby Cloud).
According to the Environment Variables Specific to Gatsby Cloud docs, you can specify the Node version by setting a NODE_VERSION environment variable, which by default is set to 12:
NODE_VERSION: Specify the version of Node.js your project should use.
For example, NODE_VERSION=10. Defaults to 12.
In your case, use a node -v locally to get your Node version and set the NODE_VERSION accordingly. This will force the cloud to use the same version as local, hence the same exact working versions.
Further revisions to this topic bypassed the issue by removing the package-lock.json and ignoring it (adding it to .gitignore) to let Gatsby Cloud install the dependencies in their own environment.
The Gatsby Cloud support suggested to delete the package-lock.json file. And that fixed the problem for me!
You need to make sure to also include package-lock.json into your .gitignore file in order to prevent it from being uploaded to GitHub the next time you build on your own machine.

How to pass argument from npm script to lerna command

I am looking to pass stage argument from npm script to lerna which will call npm script in each of the packages.
Here's what it looks like:
In deploy.sh, I run:
npm run deploy:cicd -- --stage dev
In package.json, I have:
"deploy:cicd": " lerna run deploy --stream",
In each of the packages, the deploy script looks like this:
"deploy": "sls deploy -v",
I need to be able to pass the stage name from deploy.sh so that the deploy command executed in each of the packages will be :
"sls deploy -v --stage dev ",
Currently, I get an error:
> lerna run deploy --stream "-stage" "dev"
ERR! lerna Unknown arguments: p, r, o, f, i, l, e
npm ERR! code 1
npm ERR! path /codebuild/output/src202136904/src
npm ERR! command failed
npm ERR! command sh -c lerna run deploy --stream "-stage" "dev"
In deploy.sh, I tried passing
npm run deploy:cicd -- -- -stage dev
and
npm run deploy:cicd -- -stage dev
and
npm run deploy:cicd -- stage dev
Neither of these has worked for me.

How to fix "npm ERR! Unexpected end of JSON input while parsing" on Vue CLI installation

I want to install Vue CLI . and i run this on my Git Bash .
ECLIPSE#DESKTOP-AIUUOKR MINGW64 ~
$ npm install -g #vue/cli
but having error like this :
ECLIPSE#DESKTOP-AIUUOKR MINGW64 ~
$ npm install -g #vue/cli
npm ERR! Unexpected end of JSON input while parsing near '...ery":"latest","throug'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ECLIPSE\AppData\Roaming\npm-cache\_logs\2019-10-09T02_48_52_427Z-debug.log
i try with solution in stackoverflow in this thread here
. i try with
ECLIPSE#DESKTOP-AIUUOKR MINGW64 ~/Desktop
$ npm cache clean --force
npm WARN using --force I sure hope you know what you are doing.
but i try to install again , its have same error . someone can help me about this ?
I had a very similar problem and simple npm cache clean --force command did not help too.
I solved the problem by deleting C:\Users\User\AppData\Roaming\npm and C:\Users\User\AppData\Roaming\npm-cache directories and running an npm cache clean --force command after this. Then, npm install worked properly.
If the problem continues to appear, reinstall Node.js and NPM. Do not forget to check if all previous files connected with them are deleted before the installation!
This process work for me
1 - Run your Command Invite/Terminal as Administrator
2 - Install the Vue CLI globally with the command :
npm install -g vue-cli

EBUSY on unlink from "npm install -g oauthd"

So, I have an open issue at the oauthd repo: Issue but the activity in their issue list looks very sporadic.
I'm trying to execute "npm install -g oauthd" from a MINGW32 shell.
I'm being told by the console that I am doing that wrong.
abates#MACHINE /c/dev/tools
$ npm -v
1.4.28
abates#MACHINE /c/dev/tools
$ npm install -g oauthd
npm ERR! Error: EBUSY, unlink 'C:\Users\abates\AppData\Roaming\npm\node_modules\
oauthd\node_modules\hiredis'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR! <http://github.com/npm/npm/issues>
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "c:\\Program Files\\nodejs\\node.exe" "c:\\Program Files\\nodej
s\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "oauthd"
npm ERR! cwd c:\dev\tools
npm ERR! node -v v0.10.32
npm ERR! npm -v 1.4.28
npm ERR! path C:\Users\abates\AppData\Roaming\npm\node_modules\oauthd\node_modul
es\hiredis
npm ERR! code EBUSY
npm ERR! errno 10
abates#MACHINE /c/dev/tools
$
I couldn't find any useful information about the "EBUSY, unlink..." error that seems to have triggered the crash.
To resolve the "EBUSY, unlink..." error, I upgraded node package manager to 2.1.6.
The race condition was eliminated
Check your PATH.
Make sure that
C:\<install location of node>
loads before
\user\<user>\AppData\npm
$ cd C:\<install location of node>
$npm install npm#2.1.6
$npm -v
2.1.6
$npm install oauthd -g
\
Edit
Note that for my particular installation task (oauthd), there are dependencies on hiredis and dtrace-provider that are failing to build on my machine.
My hunch is that it is ignoring the availability of MSBuild.exe in the PATH and trying to load my MSBuild location directly from the registry but the error descriptions do not lead one to a natural next step other than trial and error.
With that:
Docker to the rescue.
docker#boot2docker:~$ docker run -d --name redis - p 6379:6379 dockerfile/redis
docker#boot2docker:~$ docker run -d --name oauthd -p 443:443 -p 6284:6284 -e oauthd_host_url=http://auth.domain:6284 --link redis:redis vinc/oauthd-instance
works like a champ.
If you aren't using docker, you're doing it wrong.