Content and Map of this Source is not available (only size() is supported) Angular 13
Asked Answered
B

3

12

I have been working with angular project and have angular version is 13 and node is 16 versions.

When i use command npm run start its throwing an error(compilation error). Pasted the error below

Error: Content and Map of this Source is not available (only size() is supported)
    at SizeOnlySource._error (C:\Users\proj\node_modules\webpack-sources\lib\SizeOnlySource.js:16:10)
    at SizeOnlySource.buffer (C:\Users\proj\node_modules\webpack-sources\lib\SizeOnlySource.js:30:14)
    at _isSourceEqual (C:\Users\proj\node_modules\webpack\lib\util\source.js:21:51)
    at isSourceEqual (C:\Users\proj\node_modules\webpack\lib\util\source.js:43:17)
    at Compilation.emitAsset (C:\Users\proj\node_modules\webpack\lib\Compilation.js:4171:9)
    at C:\Users\proj\node_modules\webpack\lib\Compiler.js:548:28
    at C:\Users\proj\node_modules\webpack\lib\Compiler.js:1129:17
    at eval (eval at create (C:\Users\proj\node_modules\tapable\lib\HookCodeFactory.js:33:10), <anonymous>:13:1)
    at runMicrotasks (<anonymous>)
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

I have tried these solution.None of them are permanent solutions.

  1. Remove .angular folder from project and run npm install followed by npm run start command

  2. set sourceMap flag as false

  3. Tried to install sourceMap using npm install command

webpack version

enter image description here

These solutions are get it from the other stackoverfolw similar questions.

Anyone know why this error comes.

Do we have a permanent solution for this issue. Expecting a better solution

Botzow answered 12/5, 2022 at 5:24 Comment(1)
W
18

From the answer found here. The short and sweet of it is that the .angular folder found in your project directory sometimes gets corrupted and the best way to fix it is to delete the folder entirely. Then run npm install to recreate a bug free version, and then run ng serve (or npm run start if that's what you're used to).

Wales answered 19/6, 2022 at 16:1 Comment(3)
I hate this answer, but it works. Sounds like a package-lock.json equivalent. Very mysterious, confusing, and usually messes something up at some point. Instead of spending hours trying to figure out how to do it the right way, let's just delete it and start from scratch!Sentience
@Sentience I fully agree with you and I wish the Angular team would address this properly because it's known bug, but in the mean time this is all we have.Wales
There was some mentioning of changing the app.module in Angular section of github but there are no details given. Nevertheless this current solution works as expected.Barogram
S
3

I have Angular 14.2.12 and fix was to delete ".angular" folder, founded in the root of the application.

Substituent answered 2/5, 2023 at 8:26 Comment(1)
If you don't know where this folder is (for me, was at repository\target\angular) use "npx ng cache clean"Sponge
P
-1

Delete .angular and .node_modules. Than run npm install, afater npm start

Pyridine answered 12/9, 2022 at 19:52 Comment(2)
Your answer could be improved with additional supporting information. Please edit to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers in the help center.Gono
Hey just wanted to let you know that there is no need to delete the node_modules folder, that isn't where the issue lies. It's only in the .angular folderWales

© 2022 - 2025 — McMap. All rights reserved.