10

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

arj
  • 887
  • 1
  • 15
  • 37

3 Answers3

14

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

Carlo Nyte
  • 665
  • 6
  • 17
  • 2
    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! – mwilson Aug 04 '22 at 22:44
  • 1
    @mwilson 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. – Carlo Nyte Aug 22 '22 at 14:34
  • 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. – Necrophallus Oct 16 '22 at 16:05
1

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

Carnaru Valentin
  • 1,690
  • 17
  • 27
-1

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

  • 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](/help/how-to-answer). – Community Sep 17 '22 at 12:45
  • 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 folder – Carlo Nyte Oct 17 '22 at 08:07