Karma not running in Jenkins CI, Cannot find module 'karma-jasmine' - jenkins

I'm setting up an Angular 4 SPA with automatic testing in Jenkins CI. The SPA is part of a larger, Maven-managed project, so the build is also Maven-managed. So far I've:
Installed the NodeJS plugin on Jenkins, using install from nodejs.org with version 8.6.0
Configured "Global npm packages to install" = "karma-cli phantomjs-prebuilt jasmine-core karma-jasmine karma-phantomjs-launcher karma-junit-reporter karma-coverage"
Added the "maven-karma-plugin" in pom.xml with browsers=PhantomJS / singleRun=true / reporters=dots,junit
Enabled "Provide Node & npm bin/ folder to PATH" on the Jenkins job configuration
The build process starts up quite ok, but eventually I get:
[INFO] --- maven-karma-plugin:1.6:start (default) # webclient ---
[INFO] Executing Karma Test Suite ...
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/karma start /var/lib/jenkins/workspace/funnel_build/webclient/karma.conf.js --browsers PhantomJS --reporters dots,junit --single-run
07 10 2017 17:07:52.801:ERROR [config]: Error in config file!
{ Error: Cannot find module 'karma-jasmine'
at Function.Module._resolveFilename (module.js:527:15)
at Function.Module._load (module.js:476:23)
at Module.require (module.js:568:17)
at require (internal/module.js:11:18)
at module.exports (/var/lib/jenkins/workspace/funnel_build/webclient/karma.conf.js:9:7)
at Object.parseConfig (/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/karma/lib/config.js:410:5)
The npm install at the very beginning of the build logs:
$ /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/npm install -g karma-cli phantomjs-prebuilt jasmine-core karma-jasmine karma-phantomjs-launcher karma-junit-reporter karma-coverage
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/karma -> /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/karma-cli/bin/karma
/var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/phantomjs -> /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/bin/phantomjs
> phantomjs-prebuilt#2.1.15 install /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt
> node install.js
Considering PhantomJS found at /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/bin/phantomjs
Looks like an `npm install -g`
Could not link global install, skipping...
Download already available at /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2
Verified checksum of previously downloaded file
Extracting tar contents (via spawned process)
Removing /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/lib/phantom
Copying extracted folder /tmp/phantomjs/phantomjs-2.1.1-linux-x86_64.tar.bz2-extract-1507388835905/phantomjs-2.1.1-linux-x86_64 -> /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/lib/phantom
Writing location.js file
Done. Phantomjs binary available at /var/lib/jenkins/tools/jenkins.plugins.nodejs.tools.NodeJSInstallation/Node.js_8.6.0/lib/node_modules/phantomjs-prebuilt/lib/phantom/bin/phantomjs
npm WARN karma-jasmine#1.1.0 requires a peer of karma#* but none was installed.
npm WARN karma-junit-reporter#1.2.0 requires a peer of karma#>=0.9 but none was installed.
npm WARN karma-phantomjs-launcher#1.0.4 requires a peer of karma#>=0.9 but none was installed.
+ karma-phantomjs-launcher#1.0.4
+ karma-coverage#1.1.1
+ karma-jasmine#1.1.0
+ karma-cli#1.0.1
+ karma-junit-reporter#1.2.0
+ jasmine-core#2.8.0
+ phantomjs-prebuilt#2.1.15
updated 7 packages in 10.553s
(The reason the package 'karma' is currently not on the list is that I read somewhere that karma-cli should be used in place of karma. Adding the 'karma' package doesn't change anything, however.)
Any idea why that "Cannot find module 'karma-jasmine'" pops up? In (2) you'll see that the karma-jasmine package is listed, I find it on the server, but still it's not found by the NodeJS plugin.
Thanks, Simon

I managed to get it to work by running "npm install" as part of the build process, and then run everything on local npm packages.
The entire setup is described here: https://funneltravel.wordpress.com/2017/10/16/running-karma-with-maven-on-jenkins-ci/

Related

SAFE Stack - installing pre-requisites

The SAFE Stack Documentation says to install npm (amongst other things) as a pre-requisite to build SAFE apps. But the link refers to https://www.npmjs.com where you have to search for packages. But which ones? What to install? There are thousands of packages there.
UPDATE:
I have just noticed that the npm documentation says that npm comes bundled with node, & most third-party distributions, by default. So why does the SAFE Stack documentation show the link to npm? Is there any sense in it?
I have tried to install the npm package via NuGet. But whatever I do, running the SAFE standard template in VS ends with a NullReferenceException:
File helpers.fs
let runOrDefault args =
try
match args with
| [| target |] -> Target.runOrDefault target
| _ -> Target.runOrDefault "Run" //NullReferenceException
0
with e ->
printfn "%A" e
1
Entering dotnet run through a command prompt opens a console window containing these messages:
Starting target 'InstallClient'
.> "C:\Program Files\nodejs\npm.CMD" install (In: false, Out: false, Err: false)
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: undefined
npm ERR! notsup Not compatible with your version of node/npm: undefined
npm ERR! notsup Required: {"node":"~16","npm":"~8"}
npm ERR! notsup Actual: {"npm":"8.19.2","node":"v19.0.0"}
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-11-04T11_38_04_408Z-debug-0.log
Finished (Failed) 'InstallClient' in 00:00:02.0540071
UPDATE:
In line with Tomáš Petříček's recommendation, I installed this version of node.js: Latest LTS Version: 18.12.0 (includes npm 8.19.2)
But again, NullReferenceException in VS, and the following error messages appear when using the command prompt:
Starting target 'InstallClient'
.> "C:\Program Files\nodejs\npm.CMD" install (In: false, Out: false, Err: false)
npm ERR! code EBADENGINE
npm ERR! engine Unsupported engine
npm ERR! engine Not compatible with your version of node/npm: undefined
npm ERR! notsup Not compatible with your version of node/npm: undefined
npm ERR! notsup Required: {"node":"~16","npm":"~8"}
npm ERR! notsup Actual: {"npm":"8.19.2","node":"v18.12.0"}
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User\AppData\Local\npm-cache\_logs\2022-11-04T13_19_03_959Z-debug-0.log
Finished (Failed) 'InstallClient' in 00:00:01.9942657
---------------------------------------------------------------------
Build Time Report
---------------------------------------------------------------------
Target Duration
------ --------
Clean 00:00:00.5118885
InstallClient 00:00:01.9937254 (Process exit code '1' <> 0. Command Line: C:\Program Files\nodejs\npm.CMD install)
Run 00:00:00 (skipped)
Total: 00:00:02.6111670
Status: Failure
---------------------------------------------------------------------
Fake.Core.BuildFailedException: Target 'InstallClient' failed.
I think all you need to install is Node.js from the official download page There are two versions:
LTS (stable) - version 18 and
Current (development) - version 19
I previously installed "Current" and then run into various troubles (though different ones than you are reporting). You also seem to have 19 according to the log. I gave up with Current and reverted my setup to the LTS version. So perhaps uninstalling the Node version you have right now and installing Node LTS may help.
These adaptations made it possible to run the SAFE standard template on my PC in line with the Quick Start guidelines:
Pre-requisites:
The .NET 6 SDK //OK
node.js (>= 8.0) //OK
npm //do not use this link
Azure CLI (optional - required for Azure deployments) //OK
Continue with guidlines 1 to 6 in the "Create your first SAFE app" section. Use cmd for the dotnet run command.
Look at the node and npm versions in this error message example:
npm ERR! notsup Actual: {"npm":"8.19.2","node":"v18.12.0"}
You may have different versions of npm and node, of course.
In line with this article by Adam Johnson, do this:
Open package.json in the root folder of the template and change the versions of npm and node accordingly, like this:
"private": true,
"engines": {
"node": "18.x",
"npm": "8.x"
}
To suppress warnings, you may add *.npmrc file containing the text string engine-strict=true next to the package.json file.
This answer, however, does not solve the problem why there is a link to npm in the pre-requisites section.
The solution in this answer looks somewhat complicated so if you have got a better idea, it will be fine if you publish it.
UPDATE 08-Nov-2022
Instructions telling you how to run/debug a SAFE Stack app in Visual Studio are here. Then no more problems with NullReferenceExceptions.

Any workaround to the "Could not find prisma-fmt binary" error when installing KeystoneJS?

I'm running into this issue when trying to install KeystoneJS (tried locally with node and npm up to date and in a node:16-alpine docker image).
> keystone-app#1.0.0 postinstall
> keystone postinstall
Error: Could not find prisma-fmt binary. Searched in:
- /plur-cms/node_modules/#prisma/engines/prisma-fmt-debian-openssl-1.1.x
- /plur-cms/node_modules/#prisma/sdk/prisma-fmt-debian-openssl-1.1.x
- /plur-cms/node_modules/#prisma/prisma-fmt-debian-openssl-1.1.x
- /plur-cms/node_modules/#prisma/sdk/runtime/prisma-fmt-debian-openssl-1.1.x
at resolveBinary (/plur-cms/node_modules/#prisma/sdk/dist/resolveBinary.js:91:9)
at Object.formatSchema (/plur-cms/node_modules/#prisma/sdk/dist/engine-commands/formatSchema.js:41:25)
at getCommittedArtifacts (/plur-cms/node_modules/#keystone-6/core/dist/artifacts-f7bed9de.cjs.dev.js:398:13)
at Object.validateCommittedArtifacts (/plur-cms/node_modules/#keystone-6/core/dist/artifacts-f7bed9de.cjs.dev.js:417:21)
at postinstall (/plur-cms/node_modules/#keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js:619:5)
I have tried so far to update Prisma to the latest version, generate its binary, and place it into the correct folder for keystone. But after that keystone still doesn't run:
✨ Starting Keystone
⭐️ Dev Server Starting on http://localhost:5000
⭐️ GraphQL API Starting on http://localhost:5000/api/graphql
✨ Generating GraphQL and Prisma schemas
✨ The database is already in sync with the Prisma schema.
Error: Unknown binary target debian-openssl-3.0.x in generator client.
Possible binaryTargets: darwin, darwin-arm64, debian-openssl-1.0.x, debian-openssl-1.1.x, rhel-openssl-1.0.x, rhel-openssl-1.1.x, linux-arm64-openssl-1.1.x, linux-arm64-openssl-1.0.x, linux-arm-openssl-1.1.x, linux-arm-openssl-1.0.x, linux-musl, linux-nixos, windows, freebsd11, freebsd12, openbsd, netbsd, arm, native
at validateGenerators (/home/camopy/dev/plur-cms/node_modules/#prisma/sdk/dist/get-generators/getGenerators.js:318:17)
at getGenerators (/home/camopy/dev/plur-cms/node_modules/#prisma/sdk/dist/get-generators/getGenerators.js:122:3)
at Object.getGenerator (/home/camopy/dev/plur-cms/node_modules/#prisma/sdk/dist/get-generators/getGenerators.js:276:22)
at generatePrismaClient (/home/camopy/dev/plur-cms/node_modules/#keystone-6/core/dist/artifacts-f7bed9de.cjs.dev.js:522:21)
at async Promise.all (index 0)
at Object.generateNodeModulesArtifacts (/home/camopy/dev/plur-cms/node_modules/#keystone-6/core/dist/artifacts-f7bed9de.cjs.dev.js:518:3)
at async Promise.all (index 0)
at setupInitialKeystone (/home/camopy/dev/plur-cms/node_modules/#keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js:416:22)
at initKeystone (/home/camopy/dev/plur-cms/node_modules/#keystone-6/core/scripts/dist/keystone-6-core-scripts.cjs.dev.js:166:35)
Has any of you run into this already and found a workaround?
Or do you have a docker image with keystone 6 working?
You are running into this issue because the #prisma/client version doesn't seem to support OpenSSL 3.0.
You need to update to version 3.13.0 atleast. From version 3.13.0 prisma has added support for openssl 3.0.
Here are the release notes which mentions the same: Release notes

Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH. Could you tell me what the problem is?

I'm using npm install -g yo gulp to install yeoman and this is the error I'm getting
npm WARN deprecated cross-spawn-async#2.2.5: cross-spawn no longer requires a build toolchain, use it instead
C:\Usr\local\gulp -> C:\Usr\local\node_modules\gulp\bin\gulp.js
C:\Usr\local\yo -> C:\Usr\local\node_modules\yo\lib\cli.js
C:\Usr\local\yo-complete -> C:\Usr\local\node_modules\yo\lib\completion\index.js
> yo#3.1.0 postinstall C:\Usr\local\node_modules\yo
> yodoctor
Yeoman Doctor
Running sanity checks on your system
√ No .bowerrc file in home directory
√ Global configuration file is valid
√ NODE_PATH matches the npm root
√ No .yo-rc.json file in home directory
√ Node.js version
{ Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at notFoundError (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
cmd: 'C:\\WINDOWS\\system32\\cmd.exe /s /c "yo "--version""' }
× yo version
{ Error: Couldn't find the 'yo' binary. Make sure it's installed and in your $PATH
at notFoundError (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:8:11)
at verifyENOENT (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:43:16)
at ChildProcess.cp.emit (C:\Usr\local\node_modules\yo\node_modules\cross-spawn-async\lib\enoent.js:30:19)
at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
errno: 'ENOENT',
code: 'ENOENT',
syscall: 'spawn yo',
cmd: 'C:\\WINDOWS\\system32\\cmd.exe /s /c "yo "--version""' }
√ npm version
Found potential issues on your machine :(
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.9 (node_modules\gulp\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ gulp#4.0.2
+ yo#3.1.0
updated 2 packages in 23.31s
Run the following command to see where npm puts global packages
npm config get prefix
You'll get output similar to this
/usr/local/Cellar/node/10.5.0_1
Copy the output or path and then using any code editor open your .bashrc or .zshrc file depending on the terminal you use and paste like so
export PATH="$PATH:"/usr/local/Cellar/node/10.5.0_1/bin/""
Then after saving run
source ~/.zshrc
Like Xander Cage said.
I have uninstalled node.js -> procedure here
I have restarted my PC.
Then I installed again node.js
It work.
The above didn't work for me at all.
The following solved my problem:
clean installed nodejs and followed steps by dv-here in thread: https://github.com/zkat/npx/issues/100
Note that my npm kept pointing to C:\usr...
I think I set the npm config set prefix= to something mistakenly due to which I was >getting the error. Here's how I fixed it:
Open CMD in "Administrator" mode.
npm cache clear --force
npm install
npm config set cache C:\Users\myname\AppData\Roaming\npm-cache
npm config set prefix C:\Users\myname\AppData\Roaming\npm
I just ran into this issue on MacOS, and saw that all of my global npm binaries were symlinked into the /usr/local/bin directory, except for yo. I created a symlink using this command:
ln -s /usr/local/Cellar/node/12.10.0/bin/yo /usr/local/bin/yo
(Yours may vary)
And yo is now callable.
I had same issue and I really didn't want uninstall nodejs as I have a lot of package installed.
Tried also with the second answer and did not worked.
Then I found this ticked, that is been closed:
https://github.com/yeoman/yeoman/issues/1716
install with yarn command for me worked.
yarn global add yo
Seem then the installation went through with also binary installed.
Nevermind try to install it with npm getting same error, so looking for provide more infos

Yarn install Invariant Violation: should have a resolved reference

I'm attempting to build a release on Jenkins 2.150.1 and I'm encountering an error with yarn install:
Invariant Violation: should have a resolved reference
The install works fine on my local machine with the same configuration.
Does anybody know how I might resolve this?
verbose 0.446 Checking for configuration file "/usr/.yarnrc".
verbose 0.45 current time: 2019-06-05T03:51:11.266Z
[1/4] Resolving packages...
verbose 1.179 Performing "GET" request to
"https://registry.yarnpkg.com/ember-cli-babel".
verbose 1.286 Request "https://registry.yarnpkg.com/ember-cli-babel"
finished with status code 200.
warning Resolution field "ember-cli-babel#6.12.0" is incompatible with
requested version "ember-cli-babel#^5.1.6"
warning Resolution field "ember-cli-babel#6.12.0" is incompatible with
requested version "ember-cli-babel#^5.1.6"
warning Resolution field "ember-cli-babel#6.12.0" is incompatible with
requested version "ember-cli-babel#^5.1.6"
warning Resolution field "ember-cli-babel#6.12.0" is incompatible with
requested version "ember-cli-babel#^5.1.6"
verbose 1.435 Invariant Violation: should have a resolved reference
at invariant (/opt/yarn/lib/cli.js:1296:15)
at PackageRequest.resolveToExistingVersion (/opt/yarn/lib/cli.js:34819:51)
at PackageResolver.resolvePackagesWithExistingVersions (/opt/yarn/lib/cli.js:60937:11)
at /opt/yarn/lib/cli.js:60869:14
at Generator.next (<anonymous>)
at step (/opt/yarn/lib/cli.js:92:30)
at /opt/yarn/lib/cli.js:103:13
at <anonymous>
at process._tickCallback (internal/process/next_tick.js:188:7)
error An unexpected error occurred: "should have a resolved
reference".
info If you think this is a bug, please open a bug report with the
information provided in "/usr/src/app/yarn-error.log".
info Visit https://yarnpkg.com/en/docs/cli/install for documentation
about this command.
time="2019-06-05T03:51:12Z" level=fatal msg="build failed: building
[myapp-client]: build artifact: running build: The command '/bin/sh
c yarn --ignore-engines install --verbose' returned a non-zero code: 1"
script returned exit code 1
Relevant Dockerfile:
FROM node:8.9.4-stretch as builder
WORKDIR /usr/src/app
COPY package.json .
COPY .npmrc .
COPY yarn.lock .
COPY .bowerrc .
COPY bower.json .
RUN yarn cache clean
RUN yarn --ignore-engines install --verbose
COPY . .
RUN yarn run build:production
Discovered this was due to the CI server's yarn version.
Downgraded to version 1.3.2 locally and was able to replicate the issue.
Upgraded to yarn 1.16 and the issue disappears.
Solution: upgrade yarn:
sh "curl --compressed -o- -L https://yarnpkg.com/install.sh | sh"

Error: Missing binding "binding.node" after merge to main branch

I tried to configure automated code coverage in CI/CD in one of my branches in GitLab, and the pipeline passed perfectly within the branch, but when the admin merged the changes into the main branch, the pipeline failed due to a missing binding.
I used gitlab-ci.yml to configure my jobs in. I didn't have any experience working with pipelines, so this was pretty much a trial and error task for me.
Finally I got the configuration that was working for me that didn't break anything and produced the coverage as required. However, since it was showing a no space error prior to a successful build, I had to force clear the cache to get the jobs to run properly. Within my branch, the pipeline passed without any errors and I double checked by re-running it several times. But once the admin merged the branch it suddenly started producing the following error:
ERROR in Module build failed: Error: Missing binding /builds/internal/employee_portal/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
Found bindings for the following environments:
- Linux 64-bit with Node.js 11.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/builds/internal/employee_portal/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/builds/internal/employee_portal/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.sassLoader (/builds/internal/employee_portal/node_modules/sass-loader/lib/loader.js:46:72)
ERROR in ./src/styles.scss
Module build failed: ModuleBuildError: Module build failed: Error: Missing binding /builds/internal/employee_portal/node_modules/node-sass/vendor/linux-x64-64/binding.node
Node Sass could not find a binding for your current environment: Linux 64-bit with Node.js 10.x
Found bindings for the following environments:
- Linux 64-bit with Node.js 11.x
This usually happens because your environment has changed since running `npm install`.
Run `npm rebuild node-sass` to download the binding for your current environment.
at module.exports (/builds/internal/employee_portal/node_modules/node-sass/lib/binding.js:15:13)
at Object.<anonymous> (/builds/internal/employee_portal/node_modules/node-sass/lib/index.js:14:35)
at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10)
at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12)
at Function.Module._load (internal/modules/cjs/loader.js:530:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.sassLoader (/builds/internal/employee_portal/node_modules/sass-loader/lib/loader.js:46:72)
at runLoaders (/builds/internal/employee_portal/node_modules/webpack/lib/NormalModule.js:244:20)
at /builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:364:11
at /builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:230:18
at runSyncOrAsync (/builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:143:3)
at iterateNormalLoaders (/builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:229:2)
at Array.<anonymous> (/builds/internal/employee_portal/node_modules/loader-runner/lib/LoaderRunner.js:202:4)
at Storage.finished (/builds/internal/employee_portal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:43:16)
at provider (/builds/internal/employee_portal/node_modules/enhanced-resolve/lib/CachedInputFileSystem.js:79:9)
at /builds/internal/employee_portal/node_modules/graceful-fs/graceful-fs.js:90:16
at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
ERROR: Job failed: exit code 1
side note: The branch I was working on had been checked out from the main branch, no changes from other branches had been included into this one.
I wanted to know:
what part of my code caused this error (i suspect force clearing the cache, but just a hunch)
why this error did not appear in the pipeline of the branch I was working in?
why is the runner giving an error when it has bindings for an updated version of Node? Shouldn't it be backward compatible?
I've looked at this link, but I'm curious as to why this error never occurred before merge and even if it did, why is it giving me an error because I have an updated version installed.
Here is my gitlab-ci.yml file:
image: trion/ng-cli-karma
cache:
paths:
- node_modules/
build:
stage: build
script:
- npm cache clear --force
- npm i #angular/cli
- npm install
- npm run generate-docs
- ./node_modules/.bin/ng build --prod --base-href . --output-path www/
artifacts:
paths:
- www/
- documentation/
variables:
DOCKER_DRIVER: overlay
test:
stage: test
script:
- ./node_modules/.bin/ng test --code-coverage=true
artifacts:
paths:
- coverage/
coverage: '/(\d*.?\d+)%/'
pages:
stage: deploy
dependencies:
- build
- test
script:
- ls
- mv documentation www/
- mv coverage/ www/
- mv www/ public
- ls public/
artifacts:
paths:
- public
expire_in: 30 days
I had the same problem and npm rebuild node-sass command didn't work for me. The reason was the npm cache. If you clear the cache, issue would be resolved.
Steps followed:
Remove node modules rm -rf node_modules/
Remove cache npm cache clean --force
Verify cache removed npm cache verify
npm install

Resources