Vue-cli: Fresh default project fails to build

Created on 29 Jun 2019  ·  9Comments  ·  Source: vuejs/vue-cli

Version

3.8.4

Environment info

  System:
    OS: Linux 5.1 Arch Linux undefined
    CPU: (8) x64 Intel(R) Core(TM) i7-4771 CPU @ 3.50GHz
  Binaries:
    Node: 11.15.0 - /usr/bin/node
    Yarn: 1.16.0 - /usr/bin/yarn
    npm: 6.9.2 - /usr/bin/npm
  Browsers:
    Chrome: Not Found
    Firefox: 67.0.4
  npmPackages:
    @vue/babel-helper-vue-jsx-merge-props:  1.0.0 
    @vue/babel-plugin-transform-vue-jsx:  1.0.0 
    @vue/babel-preset-app:  3.8.0 
    @vue/babel-preset-jsx:  1.0.0 
    @vue/babel-sugar-functional-vue:  1.0.0 
    @vue/babel-sugar-inject-h:  1.0.0 
    @vue/babel-sugar-v-model:  1.0.0 
    @vue/babel-sugar-v-on:  1.0.0 
    @vue/cli-overlay:  3.8.0 
    @vue/cli-plugin-babel: ^3.8.0 => 3.8.0 
    @vue/cli-plugin-eslint: ^3.8.0 => 3.8.0 
    @vue/cli-service: ^3.8.0 => 3.8.4 
    @vue/cli-shared-utils:  3.8.0 
    @vue/component-compiler-utils:  2.6.0 
    @vue/preload-webpack-plugin:  1.1.0 
    @vue/web-component-wrapper:  1.2.0 
    eslint-plugin-vue: ^5.0.0 => 5.2.3 (4.7.1)
    vue: ^2.6.10 => 2.6.10 
    vue-eslint-parser:  2.0.3 (5.0.0)
    vue-hot-reload-api:  2.3.3 
    vue-loader:  15.7.0 
    vue-style-loader:  4.1.2 
    vue-template-compiler: ^2.6.10 => 2.6.10 
    vue-template-es2015-compiler:  1.9.1 
  npmGlobalPackages:
    @vue/cli: 3.8.4

Steps to reproduce

  • vue create foo (use default options)
  • cd foo
  • npm run build

What is expected?

Successful build.

What is actually happening?

SourceMap error, build hangs.


Dropping in a package-lock.json from yesterday fixed it.

has workaround upstream

Most helpful comment

A bug in terser 4.0.1 which was released hours ago.
For npm users: run npm i [email protected]
For yarn users: add the following field to package.json and then rerun yarn:

"resolutions": {
  "terser": "4.0.0"
}

All 9 comments

I am experiencing this same issue as of today.

When running npm run build on my Vue project, I receive the following error:

Unhandled rejection Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.

And then the build hangs.

experiencing this issue as well.

I'm experiencing the same problem:

$ npm run build

> [email protected] build /tmp/foo
> vue-cli-service build

⠙  Building for production...Unhandled rejection Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
    at SourceMapGenerator_validateMapping [as _validateMapping] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12)
    at /tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:72:17
    at Array.forEach (<anonymous>)
    at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:48:24)
    at SourceMapSource.node (/tmp/foo/node_modules/webpack-sources/lib/SourceMapSource.js:32:35)
    at SourceMapSource.proto.sourceAndMap (/tmp/foo/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
    at getTaskForFile (/tmp/foo/node_modules/webpack/lib/SourceMapDevToolPlugin.js:37:30)
    at files.forEach (/tmp/foo/node_modules/webpack/lib/SourceMapDevToolPlugin.js:136:20)
    at Array.forEach (<anonymous>)
    at compilation.hooks.afterOptimizeChunkAssets.tap (/tmp/foo/node_modules/webpack/lib/SourceMapDevToolPlugin.js:130:12)
    at SyncHook.eval [as call] (eval at create (/tmp/foo/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at SyncHook.lazyCompileHook (/tmp/foo/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeChunkAssets.callAsync.err (/tmp/foo/node_modules/webpack/lib/Compilation.js:1313:42)
    at _err0 (eval at create (/tmp/foo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)

⠇  Building for production...^C
$ node --version
v10.16.0
$ npm --version
6.9.2

For the time being, I disabled source maps as a workaround to get the project built:

vue.config.js

module.exports = {
    productionSourceMap: false
};

I am experiencing the same problem. It happens with out-of-the-box projects created with both Babel or Typescript. Create the project. Change to folder and npm run build. Gets the error.

EDIT: I have also uninstalled Vue-CLI and gone back and tried each past release going back to 3.7.0, and I am getting the same error on each one. It seems highly unlikely that such a major issue would have slipped through the cracks, so I am not sure where this issue is coming from. Or if perhaps something on my machine is causing the issue?

@TimTCrouch

No, it's not your machine.

The following is just a guess, because I'm not very familiar with Node.js.

The issue is probably caused by a breaking change or bug in a new version of a third-party dependency that was just released. NPM dependency management pulls in the latest version of the dependency, no matter which Vue CLI version you are installing.

If it's a breaking change, Vue CLI will have to adapt to that change. If it's a bug it will probably fix itself with an update of the dependency. As a temporary fix Vue CLI could declare the dependency with a version restriction.

Package-lock.json affects dependency resolution. Now I really don't know anything about that, but I think existing projects might be unaffected even if they update Vue CLI.

A bug in terser 4.0.1 which was released hours ago.
For npm users: run npm i [email protected]
For yarn users: add the following field to package.json and then rerun yarn:

"resolutions": {
  "terser": "4.0.0"
}

I'm experiencing the same problem:

$ npm run build

> [email protected] build /tmp/foo
> vue-cli-service build

⠙  Building for production...Unhandled rejection Error: original.line and original.column are not numbers -- you probably meant to omit the original mapping entirely and only map the generated position. If so, pass null for the original mapping instead of an object with empty or null values.
    at SourceMapGenerator_validateMapping [as _validateMapping] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12)
    at /tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:72:17
    at Array.forEach (<anonymous>)
    at BasicSourceMapConsumer.SourceMapConsumer_eachMapping [as eachMapping] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (/tmp/foo/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:48:24)
    at SourceMapSource.node (/tmp/foo/node_modules/webpack-sources/lib/SourceMapSource.js:32:35)
    at SourceMapSource.proto.sourceAndMap (/tmp/foo/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
    at getTaskForFile (/tmp/foo/node_modules/webpack/lib/SourceMapDevToolPlugin.js:37:30)
    at files.forEach (/tmp/foo/node_modules/webpack/lib/SourceMapDevToolPlugin.js:136:20)
    at Array.forEach (<anonymous>)
    at compilation.hooks.afterOptimizeChunkAssets.tap (/tmp/foo/node_modules/webpack/lib/SourceMapDevToolPlugin.js:130:12)
    at SyncHook.eval [as call] (eval at create (/tmp/foo/node_modules/tapable/lib/HookCodeFactory.js:19:10), <anonymous>:7:1)
    at SyncHook.lazyCompileHook (/tmp/foo/node_modules/tapable/lib/Hook.js:154:20)
    at hooks.optimizeChunkAssets.callAsync.err (/tmp/foo/node_modules/webpack/lib/Compilation.js:1313:42)
    at _err0 (eval at create (/tmp/foo/node_modules/tapable/lib/HookCodeFactory.js:33:10), <anonymous>:11:1)

⠇  Building for production...^C
$ node --version
v10.16.0
$ npm --version
6.9.2

For the time being, I disabled source maps as a workaround to get the project built:

vue.config.js

module.exports = {
    productionSourceMap: false
};

This worked as a solution to the issue! Thanks!

Fixed in terser 4.0.2

still this error... I tried to add resolutions but it doesn't work

Was this page helpful?
0 / 5 - 0 ratings

Related issues

deanilvincent picture deanilvincent  ·  38Comments

williamstar picture williamstar  ·  79Comments

wuyuweixin picture wuyuweixin  ·  35Comments

dimavolo picture dimavolo  ·  75Comments

yyx990803 picture yyx990803  ·  34Comments