Skip to content

ng eject creates a source-map error when @angular/material is used #4905

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

Closed
ricketysplit opened this issue Feb 22, 2017 · 12 comments
Closed
Labels
help wanted needs: investigation Requires some digging to determine if action is needed

Comments

@ricketysplit
Copy link

Please provide us with the following information:

OS?

Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Windows 10

Versions.

Please run ng --version. If there's nothing outputted, please run in a Terminal: node --version and paste the result here:
@angular/cli: 1.0.0-beta.32.3 (e)
node: 6.9.1
os: win32 x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.4.8
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.8
@angular/material: 2.0.0-beta.2

Repro steps.

Was this an app that wasn't created using the CLI? What change did you do on your code? etc.
Created a brand new app
Added latest @angular/material and added it to app.module
ng serve runs fine.
Ran ng eject to expose webpack.config
Now running npm start creates the error below

The log given by the failure.

Normally this include a stack trace and some more information.
10% building modules 4/4 modules 0 active(node:11492) DeprecationWarning: loaderUtils.parseQuery() received a non-string value which can be problematic, see webpack/loader-utils#56
parseQuery() will be replaced with getOptions() in the next major version of loader-utils.
92% chunk asset optimizationC:\Projects\san-diego-house\node_modules\source-map\lib\source-node.js:95
var code = nextLine.substr(0, mapping.generatedColumn -
^

TypeError: Cannot read property 'substr' of undefined
at Function. (C:\Projects\san-diego-house\node_modules\source-map\lib\source-node.js:95:30)
at Array.forEach (native)
at SourceMapConsumer_eachMapping [as eachMapping] (C:\Projects\san-diego-house\node_modules\source-map\lib\source-map-consumer.js:155:14)
at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (C:\Projects\san-diego-house\node_modules\source-map\lib\source-node.js:80:24)
at SourceMapSource.node (C:\Projects\san-diego-house\node_modules\webpack-sources\lib\SourceMapSource.js:42:20)
at ReplaceSource.node (C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ReplaceSource.js:69:29)
at CachedSource.node (C:\Projects\san-diego-house\node_modules\webpack-sources\lib\CachedSource.js:12:23)
at C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ConcatSource.js:40:49
at Array.map (native)
at ConcatSource.node (C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ConcatSource.js:39:60)
at C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ConcatSource.js:40:49
at Array.map (native)
at ConcatSource.node (C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ConcatSource.js:39:60)
at C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ConcatSource.js:40:49
at Array.map (native)
at ConcatSource.node (C:\Projects\san-diego-house\node_modules\webpack-sources\lib\ConcatSource.js:39:60)

Mention any other details that might be useful.


Thanks! We'll be in touch soon.

@ScallyGames
Copy link

ScallyGames commented Feb 22, 2017

Same problem occured to me yesterday - haven't found any solution yet.

Possibly related: mozilla/source-map#247

@ScallyGames
Copy link

As a quick workaround setting "devtool": "eval" in webpack.config.js makes the build run again.

However a proper solution is needed.

@kamalkech
Copy link

@Aides359 : i can't find webpack.config.js in root folder of project

@thecameraguy
Copy link

@kamalkech 'ng eject' should have generated webpack.config.js at your root.

I am having this exact issue as well.. Trying to override the default url-loader for .cur and .ani files and I thought I found the solution with ng eject but alas.... hopefully this issue is the last hurdle..

@jackytse
Copy link

jackytse commented Mar 1, 2017

Don't write two or more classes in the same ts file. I think it's a bug of 'source-map'.

@ScallyGames
Copy link

I am 100% sure that I have no file with more than one class in it.
If anything it is a problem with import/export and not with class declarations.

@jackytse
Copy link

jackytse commented Mar 2, 2017

Maybe you can try this solution.

http://stackoverflow.com/questions/41907409/typeerror-cannot-read-property-substr-of-undefined-source-node-js

@ScallyGames
Copy link

That's it!

PS: @jackytse your link is not referencing the correct target

@jackytse
Copy link

jackytse commented Mar 2, 2017

@filipesilva filipesilva added the needs: investigation Requires some digging to determine if action is needed label Mar 13, 2017
@rabenhorst
Copy link

rabenhorst commented Mar 22, 2017

We have exactly the same problem but only with Windows 7. Under macOS 10.12 it's working fine. Is there a satisfying solutions yet?

@clydin
Copy link
Member

clydin commented Aug 23, 2018

CLI 1.0 prerelease versions are no longer supported. If this error still occurs on the latest version (6.1.4 currently). Please open a new issue describing the problem.

@clydin clydin closed this as completed Aug 23, 2018
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 8, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
help wanted needs: investigation Requires some digging to determine if action is needed
Projects
None yet
Development

No branches or pull requests

9 participants