Search code examples
angularsource-mapsnpm-start

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


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


Solution

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