Skip to content

Error aSource is not in the SourceMap #1982

Closed

Description

@chosroes

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.

Activity

  1. chosroes commented on Sep 5, 2016

    @chosroes
    Author

    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

  2. Chabane commented on Sep 5, 2016

    @Chabane

    I have the same issue on Mac OS X Yosemite.

  3. rokde commented on Sep 15, 2016

    @rokde

    The same on:

    • angular-cli: 1.0.0-beta.14
    • node: 6.4.0
    • os: linux x64
  4. divid3byzero commented on Sep 20, 2016

    @divid3byzero

    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...

  5. joao-fidalgo commented on Sep 20, 2016

    @joao-fidalgo

    Having the same issue.

  6. Djuki commented on Sep 25, 2016

    @Djuki

    Same issue:

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

  7. MartinNuc commented on Sep 25, 2016

    @MartinNuc

    Same issue.

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

  8. brianmadden commented on Sep 27, 2016

    @brianmadden

    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.

  9. CalebMacdonaldBlack commented on Oct 3, 2016

    @CalebMacdonaldBlack

    @brianmadden Thank you so much! this worked for me

  10. ewu-youngb commented on Oct 3, 2016

    @ewu-youngb

    @brianmadden Thanks, that helped!

  11. svensp commented on Oct 5, 2016

    @svensp

    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.

  12. filipesilva commented on Oct 9, 2016

    @filipesilva
    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.

  13. brianmadden commented on Oct 10, 2016

    @brianmadden

    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.

  14. 1 remaining item

  15. filipesilva commented on Oct 10, 2016

    @filipesilva
    Contributor

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

  16. chosroes commented on Oct 13, 2016

    @chosroes
    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.

  17. filipesilva commented on Oct 14, 2016

    @filipesilva
    Contributor

    Fixed by #2291

  18. vinchauhan commented on Oct 18, 2016

    @vinchauhan

    Same issue

  19. vinchauhan commented on Oct 19, 2016

    @vinchauhan

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

  20. derailed commented on Nov 3, 2016

    @derailed

    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.');

  21. doliver3 commented on Nov 23, 2016

    @doliver3

    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.

  22. mayakwd commented on Dec 12, 2016

    @mayakwd

    Any workaround? Same issue

  23. JSMike commented on Jan 12, 2017

    @JSMike
    Contributor

    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

  24. valterbarros commented on Feb 1, 2017

    @valterbarros

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

  25. JSMike commented on Feb 2, 2017

    @JSMike
    Contributor

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

  26. valterbarros commented on Feb 2, 2017

    @valterbarros

    @JSMike Thank it's work here

  27. angular-automatic-lock-bot commented on Sep 6, 2019

    @angular-automatic-lock-bot

    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.

  28. locked and limited conversation to collaborators on Sep 6, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions