I'm seeing an error with npm when I try to build a VueJS application. I'm seeing this error inside of a build
stage in GitLab CI. I haven't been able to find any mention of the error message. I have previously been able to run npm run build
successfully and I haven't made any changes to the Vue application code, so I'm unsure what could be causing this error.
- Building for production...
ERROR Error: custom keyword definition is invalid: data.errors should be boolean
Error: custom keyword definition is invalid: data.errors should be boolean
at Ajv.addKeyword (/app/node_modules/ajv/lib/keyword.js:65:13)
at module.exports (/app/node_modules/ajv-errors/index.js:10:7)
at Object.<anonymous> (/app/node_modules/terser-webpack-plugin/node_modules/schema-utils/src/validateOptions.js:22:1)
at Module._pile (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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-02-09T22_32_54_384Z-debug.log
The mand '/bin/sh -c npm run build' returned a non-zero code: 1
ERROR: Job failed: exit code 1
Here is what I have in my docker file that is used to build the Vue app:
# build stage
FROM node:10.14.2-jessie as build-stage
WORKDIR /app/
COPY frontend/package.json /app/
RUN npm cache verify
RUN npm install
COPY frontend /app/
RUN npm run build
I'm seeing an error with npm when I try to build a VueJS application. I'm seeing this error inside of a build
stage in GitLab CI. I haven't been able to find any mention of the error message. I have previously been able to run npm run build
successfully and I haven't made any changes to the Vue application code, so I'm unsure what could be causing this error.
- Building for production...
ERROR Error: custom keyword definition is invalid: data.errors should be boolean
Error: custom keyword definition is invalid: data.errors should be boolean
at Ajv.addKeyword (/app/node_modules/ajv/lib/keyword.js:65:13)
at module.exports (/app/node_modules/ajv-errors/index.js:10:7)
at Object.<anonymous> (/app/node_modules/terser-webpack-plugin/node_modules/schema-utils/src/validateOptions.js:22:1)
at Module._pile (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)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `vue-cli-service build`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A plete log of this run can be found in:
npm ERR! /root/.npm/_logs/2019-02-09T22_32_54_384Z-debug.log
The mand '/bin/sh -c npm run build' returned a non-zero code: 1
ERROR: Job failed: exit code 1
Here is what I have in my docker file that is used to build the Vue app:
# build stage
FROM node:10.14.2-jessie as build-stage
WORKDIR /app/
COPY frontend/package.json /app/
RUN npm cache verify
RUN npm install
COPY frontend /app/
RUN npm run build
Share
Improve this question
edited Feb 9, 2019 at 23:13
briancaffey
asked Feb 9, 2019 at 22:52
briancaffeybriancaffey
2,56810 gold badges40 silver badges65 bronze badges
7
-
2
Got the exact same error on a freshly install vue app. Mine was on
npm run serve
. – d00dle Commented Feb 9, 2019 at 23:10 - 1 A look at the repo for the package shows the file reported by npm was updated an hour ago. Did you by any chance just update the npm dependencies? – d00dle Commented Feb 9, 2019 at 23:13
- 2 The issue has been raised on the repo. Multiple dependent packages are hit. – d00dle Commented Feb 9, 2019 at 23:14
- 2 It's a simple work around for now but it worked for me. I set "ajv": "6.8.1" -> github./rogeriochaves/npm-force-resolutions – Diemuzi Commented Feb 9, 2019 at 23:33
- 1 Still getting this issue on 6.9.0 after npm update – Zach Commented Feb 10, 2019 at 7:38
3 Answers
Reset to default 5https://github./webpack/webpack/issues/8768
If you use yarn
add below to package.json
"resolutions": {
"ajv": "6.8.1"
}
then run yarn install
if you use npm
npm uninstall ajv
npm install [email protected]
In the node-modules I renamed ajv folder to ajv1. Now I copied an older version of ajv folder into node-modules folder from some other installation. It worked.
Quick fix:
Go to the ajv dependency in your node_modules folder:
node_modules/ajv/lib/keyword.js
ment out the line 64 and 65 :
if (!validateDefinition(definition))
throw new Error('custom keyword definition is invalid: ' + this.errorsText(validateDefinition.errors));
and it should works without side effects.
发布者:admin,转转请注明出处:http://www.yc00.com/questions/1745673553a4639548.html
评论列表(0条)