[SOLVED] Error - npm run build-dev - Framework7-CLI

I’ve managed to setup single view react app using framework7-cli. When build it is giving below error.

Yeshans-MacBook-Pro:webApp yeshansachithak$ npm run build-dev

> [email protected] build-dev /Volumes/dataStorage/webApp
> cross-env NODE_ENV=development node ./build/build.js

/Volumes/dataStorage/webApp/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/validate.js:104
    throw new _ValidationError.default(errors, schema, configuration);
    ^

ValidationError: Invalid options object. Terser Plugin has been initialized using an options object that does not match the API schema.
 - options has an unknown property 'sourceMap'. These properties are valid:
   object { test?, include?, exclude?, parallel?, minify?, terserOptions?, extractComments? }
    at validate (/Volumes/dataStorage/webApp/node_modules/terser-webpack-plugin/node_modules/schema-utils/dist/validate.js:104:11)
    at new TerserPlugin (/Volumes/dataStorage/webApp/node_modules/terser-webpack-plugin/dist/index.js:32:31)
    at Object.<anonymous> (/Volumes/dataStorage/webApp/build/webpack.config.js:55:17)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Module.require (internal/modules/cjs/loader.js:903:19)
    at require (internal/modules/cjs/helpers.js:74:18)
    at Object.<anonymous> (/Volumes/dataStorage/webApp/build/build.js:5:16)
    at Module._compile (internal/modules/cjs/loader.js:1015:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
    at Module.load (internal/modules/cjs/loader.js:879:32)
    at Function.Module._load (internal/modules/cjs/loader.js:724:14)
    at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
    at internal/main/run_main_module.js:17:47 {
  errors: [
    {
      keyword: 'additionalProperties',
      dataPath: '',
      schemaPath: '#/additionalProperties',
      params: { additionalProperty: 'sourceMap' },
      message: 'should NOT have additional properties',
      schema: false,
      parentSchema: {
        definitions: {
          Rule: {
            description: 'Filtering rule as regex or string.',
            anyOf: [Array]
          },
          Rules: { description: 'Filtering rules.', anyOf: [Array] }
        },
        title: 'TerserPluginOptions',
        type: 'object',
        additionalProperties: false,
        properties: {
          test: {
            description: 'Include all modules that pass test assertion.',
            oneOf: [Array]
          },
          include: {
            description: 'Include all modules matching any of these conditions.',
            oneOf: [Array]
          },
          exclude: {
            description: 'Exclude all modules matching any of these conditions.',
            oneOf: [Array]
          },
          parallel: {
            description: 'Use multi-process parallel running to improve the build speed.',
            anyOf: [Array]
          },
          minify: {
            description: 'Allows you to override default minify function.',
            instanceof: 'Function'
          },
          terserOptions: {
            description: 'Options for `terser`.',
            additionalProperties: true,
            type: 'object'
          },
          extractComments: {
            description: 'Whether comments shall be extracted to a separate file.',
            anyOf: [Array]
          }
        }
      },
      data: { sourceMap: true }
    }
  ],
  schema: {
    definitions: {
      Rule: {
        description: 'Filtering rule as regex or string.',
        anyOf: [
          { instanceof: 'RegExp', tsType: 'RegExp' },
          { type: 'string', minLength: 1 }
        ]
      },
      Rules: {
        description: 'Filtering rules.',
        anyOf: [
          { type: 'array', items: [Object] },
          { '$ref': '#/definitions/Rule' }
        ]
      }
    },
    title: 'TerserPluginOptions',
    type: 'object',
    additionalProperties: false,
    properties: {
      test: {
        description: 'Include all modules that pass test assertion.',
        oneOf: [ { '$ref': '#/definitions/Rules' } ]
      },
      include: {
        description: 'Include all modules matching any of these conditions.',
        oneOf: [ { '$ref': '#/definitions/Rules' } ]
      },
      exclude: {
        description: 'Exclude all modules matching any of these conditions.',
        oneOf: [ { '$ref': '#/definitions/Rules' } ]
      },
      parallel: {
        description: 'Use multi-process parallel running to improve the build speed.',
        anyOf: [ { type: 'boolean' }, { type: 'integer' } ]
      },
      minify: {
        description: 'Allows you to override default minify function.',
        instanceof: 'Function'
      },
      terserOptions: {
        description: 'Options for `terser`.',
        additionalProperties: true,
        type: 'object'
      },
      extractComments: {
        description: 'Whether comments shall be extracted to a separate file.',
        anyOf: [
          { type: 'boolean' },
          { type: 'string' },
          { instanceof: 'RegExp' },
          { instanceof: 'Function' },
          {
            additionalProperties: false,
            properties: [Object],
            type: 'object'
          }
        ]
      }
    }
  },
  headerName: 'Terser Plugin',
  baseDataPath: 'options',
  postFormatter: null
}
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-dev: `cross-env NODE_ENV=development node ./build/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build-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/yeshansachithak/.npm/_logs/2020-10-19T06_14_49_732Z-debug.log
Yeshans-MacBook-Pro:webApp yeshansachithak$
1 Like

I’ve update global npm modules and now f7-cli working without an issue.

npm list -g

will list global node modules and will show the errors. In my case, I had to update webpack to support [email protected]

npm install -g webpack

installed the latest webpack and now able to build the app. Thanks