Repository navigation
Error aSource is not in the SourceMap #1982
Copy link
Copy link
Closed
Labels
needs: more infoReporter must clarify the issueReporter must clarify the issue
Description
Please provide us with the following information:
- OS? Windows 7, 8 or 10. Linux (which distribution). Mac OSX (Yosemite? El Capitan?)
Ubuntu 16.04 - Versions. Please run
ng --version. If there's nothing outputted, please run
in a Terminal:node --versionand paste the result here:
angular-cli: local (v1.0.0-beta.11-webpack.8, branch: master)
node: 6.5.0
os: linux x64 - 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 - 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)
- Mention any other details that might be useful.
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
needs: more infoReporter must clarify the issueReporter must clarify the issue
Activity
chosroes commentedon Sep 5, 2016
When I set a new project withng new foo --link-cli, the problem doesn't occur.I have donenpm link angular-clion 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 commentedon Sep 5, 2016
I have the same issue on Mac OS X Yosemite.
rokde commentedon Sep 15, 2016
The same on:
divid3byzero commentedon Sep 20, 2016
I have the same issue with if angular-cli is installed globally:
Works if the CLI ist installed locally. Possibly some rights issue? Even though the error would then probably be somehow different...
joao-fidalgo commentedon Sep 20, 2016
Having the same issue.
Djuki commentedon Sep 25, 2016
Same issue:
angular-cli: 1.0.0-beta.15
node: 6.6.0
os: linux x64
MartinNuc commentedon Sep 25, 2016
Same issue.
angular-cli: 1.0.0-beta.15
node: 6.6.0
os: darwin x64
brianmadden commentedon 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 -dfxfollowed bynpm installfollowed byng serveand 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 commentedon Oct 3, 2016
@brianmadden Thank you so much! this worked for me
ewu-youngb commentedon Oct 3, 2016
@brianmadden Thanks, that helped!
svensp commentedon 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 asapp/so the app directory is not included in the sourcemap.filipesilva commentedon Oct 9, 2016
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 commentedon Oct 10, 2016
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 cleanand re-run ofnpm installfixed the issue for me.1 remaining item
filipesilva commentedon Oct 10, 2016
This might solve it then #2291. Can you test making this change manually?
chosroes commentedon Oct 13, 2016
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 commentedon Oct 14, 2016
Fixed by #2291
vinchauhan commentedon Oct 18, 2016
Same issue
vinchauhan commentedon Oct 19, 2016
For some of us the command - ng new app-name - needs to be run with sudo
derailed commentedon 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 commentedon Nov 23, 2016
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 commentedon Dec 12, 2016
Any workaround? Same issue
JSMike commentedon 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 commentedon Feb 1, 2017
@JSMike how can install with
--no-bin-links,it's a flag in ng? Thank youJSMike commentedon Feb 2, 2017
it's an NPM flag, you can do
ng new ProjectName --skip-npmand thennpm install --no-bin-linksvalterbarros commentedon Feb 2, 2017
@JSMike Thank it's work here
angular-automatic-lock-bot commentedon Sep 6, 2019
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.