Skip to content

Error aSource is not in the SourceMap #1982

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
chosroes opened this issue Sep 5, 2016 · 28 comments
Closed

Error aSource is not in the SourceMap #1982

chosroes opened this issue Sep 5, 2016 · 28 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@chosroes
Copy link

chosroes commented Sep 5, 2016

Please provide us with the following information:

  1. OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
    Ubuntu 16.04
  2. Versions. Please run ng --version. If there's nothing outputted, please run
    in a Terminal: node --version and paste the result here:
    angular-cli: local (v1.0.0-beta.11-webpack.8, branch: master)
    node: 6.5.0
    os: linux x64
  3. Repro steps. Was this an app that wasn't created using the CLI? What change did you
    do on your code? etc.
    I updated to master branch and tried to build or serve
  4. The log given by the failure. Normally this include a stack trace and some
    more information.
/home/test/angular-cli/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:704
      throw new Error('"' + aSource + '" is not in the SourceMap.');
            ^
Error: "/home/test/angular-cli/node_modules/angular2-template-loader/index.js!/var/www/html/public/project/src/app/app.component.ts" is not in the SourceMap.
    at SourceMapConsumer_sourceContentFor [as sourceContentFor] (/home/test/angular-cli/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:704:13)
    at /home/test/angular-cli/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:133:40
    at Array.forEach (native)
    at Function.SourceNode_fromStringWithSourceMap [as fromStringWithSourceMap] (/home/test/angular-cli/node_modules/webpack-sources/node_modules/source-map/lib/source-node.js:132:32)
    at SourceMapSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/SourceMapSource.js:42:20)
    at ReplaceSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/ReplaceSource.js:66:29)
    at CachedSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/CachedSource.js:12:23)
    at /home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:40:49
    at Array.map (native)
    at ConcatSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:39:60)
    at /home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:40:49
    at Array.map (native)
    at ConcatSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:39:60)
    at /home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:40:49
    at Array.map (native)
    at ConcatSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:39:60)
    at /home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:40:49
    at Array.map (native)
    at ConcatSource.node (/home/test/angular-cli/node_modules/webpack-sources/lib/ConcatSource.js:39:60)
    at ConcatSource.proto.sourceAndMap (/home/test/angular-cli/node_modules/webpack-sources/lib/SourceAndMapMixin.js:28:18)
    at CachedSource.sourceAndMap (/home/test/angular-cli/node_modules/webpack-sources/lib/CachedSource.js:51:28)
    at Compilation.<anonymous> (/home/test/angular-cli/node_modules/webpack/lib/SourceMapDevToolPlugin.js:57:32)
  1. Mention any other details that might be useful.
@chosroes
Copy link
Author

chosroes commented Sep 5, 2016

When I set a new project with ng new foo --link-cli, the problem doesn't occur.
I have done npm link angular-cli on the old one.

It doesn't work under /var/www/html/public but it does under /home/myuser
Is it because angular-cli is cloned under my user folder ?

It works when i copy the cloned folder under my project node_modules folder

@Chabane
Copy link

Chabane commented Sep 5, 2016

I have the same issue on Mac OS X Yosemite.

@rokde
Copy link

rokde commented Sep 15, 2016

The same on:

  • angular-cli: 1.0.0-beta.14
  • node: 6.4.0
  • os: linux x64

@divid3byzero
Copy link

divid3byzero commented Sep 20, 2016

I have the same issue with if angular-cli is installed globally:

  • angular-cli: 1.0.0-beta.15
  • node: 6.4.0
  • os: darwin x64 (El Capitan 10.11.6)

Works if the CLI ist installed locally. Possibly some rights issue? Even though the error would then probably be somehow different...

@joao-fidalgo
Copy link

Having the same issue.

@Djuki
Copy link

Djuki commented Sep 25, 2016

Same issue:

angular-cli: 1.0.0-beta.15
node: 6.6.0
os: linux x64

@MartinNuc
Copy link

MartinNuc commented Sep 25, 2016

Same issue.

angular-cli: 1.0.0-beta.15
node: 6.6.0
os: darwin x64

@ghost
Copy link

ghost commented Sep 25, 2016

Same on Mac os El Capitan:

angular-cli: 1.0.0-beta.15
node: 6.6.0
os: darwin x64

@brianmadden
Copy link

brianmadden commented Sep 27, 2016

Same issue.
angular-cli: 1.0.0-beta.15
node: 4.2.6
os: Ubuntu 16.04 x64

Additional details: Created the project on my laptop (also Ubuntu 16.04, angular-cli 1.0.0-beta.15, node 4.2.6) and it built/served fine. This failure occurs on my desktop after git cloneing the repo.

Edit: Ran a git clean -dfx followed by npm install followed by ng serve and it seems to be working now. I'm guessing there was some leftover stuff in the directory from prior to migrating my project to use angular-cli.

@CalebMacdonaldBlack
Copy link

@brianmadden Thank you so much! this worked for me

@ewu-youngb
Copy link

@brianmadden Thanks, that helped!

@svensp
Copy link

svensp commented Oct 5, 2016

For us this happens when we give the node_modules as symlink instead of a folder inside the source. Presumably the webpack tries to include node_modules/.. into the sourcemap.
Since it is a symlink app/node_modules/.. is not actualy the same as app/ so the app directory is not included in the sourcemap.

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Oct 9, 2016
@filipesilva
Copy link
Contributor

I'm having some trouble understanding this issue. So this happens when using the master branch directly, right? What else are you doing? Can you give me very explicit instructions for me to repro it?

I use the master branch every day and haven't ever seen this happen, so I'm wondering what the setup is, and how it differs from mine.

@brianmadden
Copy link

I think my case was caused by re-using an existing directory for my project. When I initially set the project up I re-used my existing project directory. Prior to initializing the cli project I did a rm -rf * in the project directory and everything worked on that computer.

I then pushed to github and pulled on my laptop. This is where I believe things went wrong. There were files left over on my laptop from the old project, but they weren't tracked by git so weren't deleted when I pulled. I think the problem was the lingering files, and this is why the git clean and re-run of npm install fixed the issue for me.

@rokde
Copy link

rokde commented Oct 10, 2016

@svensp said, that we are using a symlinked "node_modules" folder. And running the build process does not handle the correct resolvement of the "../node_modules" (in webpack) to get the correct real path.

This happens in our docker node environment where the node_modules folder is just a symlink from within the docker image/container. So your project dir has not the node_modules content, only the symlink.

@filipesilva
Copy link
Contributor

filipesilva commented Oct 10, 2016

This might solve it then #2291. Can you test making this change manually?

@chosroes
Copy link
Author

I updated to latest angular-cli (no master anymore).
What I've done:
sudo npm uninstall -g angular-cli
sudo npm cache clean
sudo npm install -g angular-cli@latest
rm -rf node_modules dist tmp
npm link angular-cli
ng init

Then ng serve. And I still have the error.

I do not have angular-cli/models/webpack-build-common.ts file in my node_modules.

My project was initiated on beta.11-webpack.8 version. And I updated regularly the code.

@filipesilva
Copy link
Contributor

Fixed by #2291

@vinchauhan
Copy link

Same issue

@vinchauhan
Copy link

For some of us the command - ng new app-name - needs to be run with sudo

@derailed
Copy link

derailed commented Nov 3, 2016

Having the exact same issue building a docker image. Using Node:6.7.0 and CLI:1.0.0-beta.19-3. It works fine in dev mode but when I change NODE_ENV=production, $ ng build, fails with the following error:

/usr/lib/node_modules/angular-cli/node_modules/webpack-sources/node_modules/source-map/lib/source-map-consumer.js:704
throw new Error('"' + aSource + '" is not in the SourceMap.');

@doliver3
Copy link

I have the same problem on linux with a brand new folder and use of ng init and latest version of node 7. This issue is not fixed.

@mayakwd
Copy link

mayakwd commented Dec 12, 2016

Any workaround? Same issue

@JSMike
Copy link
Contributor

JSMike commented Jan 12, 2017

For docker users. Are your node_modules being shared from the host machine? there may be an issue with how docker follows the sym-links in your mounted directories. Look into installing node_modules with --no-bin-links

@valterbarros
Copy link

@JSMike how can install with --no-bin-links, it's a flag in ng? Thank you

@JSMike
Copy link
Contributor

JSMike commented Feb 2, 2017

it's an NPM flag, you can do ng new ProjectName --skip-npm and then npm install --no-bin-links

@valterbarros
Copy link

@JSMike Thank it's work here

@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 6, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests