npm run build fails with “Error: custom keyword definition is invalid: data.errors should be boolean”

  • A+
Category:Languages

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._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) npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! code@0.1.0 build: `vue-cli-service build` npm ERR! Exit status 1 npm ERR!  npm ERR! Failed at the code@0.1.0 build 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/2019-02-09T22_32_54_384Z-debug.log The command '/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 

 


https://github.com/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 ajv@6.8.1 

Comment

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: