Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: original.line and original.column are not numbers #304

Closed
wvankuipers opened this issue Nov 7, 2017 · 14 comments
Closed

Error: original.line and original.column are not numbers #304

wvankuipers opened this issue Nov 7, 2017 · 14 comments

Comments

@wvankuipers
Copy link

Note: This is a report coming from webpack-sources#28

Issue
When running the source-map package agains a project with Backbone.Marionette (also reports for Vue and possibly more frameworks) the package generates an error and exits.

Steps to reproduce
I created a small repo here that has this issue. When debugging the issue I pinpointed the culprit to be this line in the Backbone.Marionette library:

typeof define === 'function' && define.amd ? define(['backbone', 'underscore', 'backbone.radio'], factory) :

And then specifically:

define(['backbone', 'underscore', 'backbone.radio'], factory)

Even removing the rest of that file's content and leaving only this part there will cause source-map to fail with the error above... Removing this line and source-map wil succeed.

Expected behaviour
Create the package as expected, this can be tested by setting sourceMap: null to the configuration of the babel-minify-webpack-plugin package. (this will disable the source-map execution)

Actual behaviour

        throw new Error(
        ^

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] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12)
    at frontend/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] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (frontend/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:48:24)
    at SourceMapSource.node (frontend/node_modules/webpack-sources/lib/SourceMapSource.js:32:35)
    at SourceMapSource.proto.sourceAndMap (frontend/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
    at getTaskForFile (frontend/node_modules/webpack/lib/SourceMapDevToolPlugin.js:33:30)
    at chunk.files.forEach.file (frontend/node_modules/webpack/lib/SourceMapDevToolPlugin.js:91:21)```
@loopmode
Copy link

The problem seems to stem from webpack-sources@1.0.2. Keeping it at 1.0.1 should help as a workaround.

@ghost
Copy link

ghost commented Dec 5, 2017

@loopmode Thank you. you're great.

@alex-kinokon
Copy link

So is this a problem with webpack-sources or source-map?

@jussikinnula
Copy link

I'm also interested on this one.

@wvankuipers
Copy link
Author

@tromey Is there any chance that someone can look into this?

@tromey
Copy link
Contributor

tromey commented Jan 3, 2018

I think this error is intentional, to catch a case where the library was being called incorrectly. See #265.

So, my first thought is that the fix belongs elsewhere. I'm open to arguments to the contrary, but I'm afraid you'd have to walk me through it a bit -- like, why is the caller calling into source-map this way? Which part of the condition is believed to be wrong and why?

@Reinmar
Copy link

Reinmar commented Jan 16, 2018

This affects my projects as well.

If anyone wants to reproduce it, there seems to be a DUP in webpack/webpack#6131 describing steps to do so.

Also, you can reproduce this in my project:

git clone git@github.com:ckeditor/ckeditor5-build-classic.git
cd ckeditor5-build-classic
git co stable

Now, edit package.json to remove the hardcoded webpack-sources. And then:

npm i
./node_modules/.bin/webpack

Result:

/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276
        throw new Error(
        ^

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] (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:276:15)
    at SourceMapGenerator_addMapping [as addMapping] (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:110:12)
    at /workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:72:17
    at Array.forEach (native)
    at SourceMapConsumer_eachMapping [as eachMapping] (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:157:14)
    at Function.SourceMapGenerator_fromSourceMap [as fromSourceMap] (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/node_modules/source-map/lib/source-map-generator.js:48:24)
    at SourceMapSource.node (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/lib/SourceMapSource.js:32:35)
    at /workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/lib/ConcatSource.js:59:50
    at Array.map (native)
    at ConcatSource.node (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/lib/ConcatSource.js:58:63)
    at ConcatSource.proto.sourceAndMap (/workspace/test/ckeditor5-build-classic/node_modules/webpack-sources/lib/SourceAndMapMixin.js:30:18)
    at getTaskForFile (/workspace/test/ckeditor5-build-classic/node_modules/webpack/lib/SourceMapDevToolPlugin.js:33:30)
    at chunk.files.forEach.file (/workspace/test/ckeditor5-build-classic/node_modules/webpack/lib/SourceMapDevToolPlugin.js:91:21)
    at Array.forEach (native)
    at /workspace/test/ckeditor5-build-classic/node_modules/webpack/lib/SourceMapDevToolPlugin.js:89:18
    at Array.forEach (native)
...

@mitchhentges
Copy link

BTW, for a simpler reproduce environment, the official electron-webpack-quick-start can be used:

  1. git clone https://github.com/electron-userland/electron-webpack-quick-start
  2. cd electron-webpack-quick-start
  3. npm i
  4. npm run compile

For future reference, this is reproducible on the current most-recent commit (0f0ec413af42174600b35d19762edd11f7c423e2)

rocka added a commit to Rocket1184/electron-netease-cloud-music that referenced this issue Feb 7, 2018
@sgaloux
Copy link

sgaloux commented Feb 14, 2018

Is there a valid workaround?

@trusktr
Copy link

trusktr commented Apr 28, 2018

This is quite something! I am on Webpack 3.10.0, and I started getting this error when I added

    devtool: DEV ? 'eval-source-map' : 'source-map',

to my webpack.config.js. I have webpack-sources at 1.1.0.

@trusktr
Copy link

trusktr commented Apr 29, 2018

After updating to Webpack 4 and removing babel-minify-webpack-plugin I no longer get this error.

@alexander-akait
Copy link

Problem in babel-minify plugin webpack-contrib/babel-minify-webpack-plugin#68. Issue can be close here. thanks!

@z3by
Copy link

z3by commented Jun 30, 2019

worked for me.

npm i terser@4.0.0
npm run build

@ordinaryparksee
Copy link

@z3by I would like to say you saved my soul

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests