question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error start with yarn dev

See original GitHub issue

Describe the bug

Error in new installation with yarn dev

To Reproduce

yarn dev

PS E:\aaa-oposiciones> yarn dev     
yarn run v1.22.5
$ cross-env NODE_ENV=development webpack-dev-server --config ./build/webpack.config.js
E:\aaa-oposiciones\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 (E:\aaa-oposiciones\node_modules\schema-utils\dist\validate.js:104:11)
    at new TerserPlugin (E:\aaa-oposiciones\node_modules\terser-webpack-plugin\dist\index.js:32:31)
    at Object.<anonymous> (E:\aaa-oposiciones\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 WEBPACK_OPTIONS (E:\aaa-oposiciones\node_modules\webpack-cli\bin\utils\convert-argv.js:114:13)
    at requireConfig (E:\aaa-oposiciones\node_modules\webpack-cli\bin\utils\convert-argv.js:116:6)
    at E:\aaa-oposiciones\node_modules\webpack-cli\bin\utils\convert-argv.js:123:17
    at Array.forEach (<anonymous>)
    at module.exports (E:\aaa-oposiciones\node_modules\webpack-cli\bin\utils\convert-argv.js:121:15)
    at Object.<anonymous> (E:\aaa-oposiciones\node_modules\webpack-dev-server\bin\webpack-dev-server.js:84:40)    at Module._compile (internal/modules/cjs/loader.js:1015:30) {
  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
}
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Expected behavior

Start in dev mode

Actual Behavior

Error and no start return code 1

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:5 (1 by maintainers)

github_iconTop GitHub Comments

23reactions
yeshansachithakcommented, Oct 19, 2020

Had to change "terser-webpack-plugin": "^5.1.0" to "terser-webpack-plugin": "^4.2.3"

2reactions
EloFrancommented, Oct 17, 2020

ok, correct, it works, whit me, using these webpack versions in package.json

"webpack": "^4.44.2",
    "webpack-cli": "3.3.12",
    "webpack-dev-server": "^3.11.0",
    "workbox-webpack-plugin": "^5.1.4"
Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: yarn start - error Command "start" not found
this error happens when you're running yarn start in a wrong directory instead of the root directory where package.json is. if they didn't...
Read more >
Error Codes | Yarn - Package Manager
This information message occurs when Yarn wishes to let you know that a package will need to be rebuilt in order for the...
Read more >
`yarn start` fails with error message · Issue #1155 - GitHub
The underlying issue was that the yarn path was set incorrectly. If you have this error then you will see a yarn-error.log file...
Read more >
Yarn Start not working : r/react - Reddit
When I run yarn start I would get: warning package.json: No license field error Command "start" not found.
Read more >
yarn: command not found error [Solved] | bobbyhadz
To solve the error "yarn: command not found", install the yarn package globally by running npm install -g yarn and restart your terminal....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found