Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cannot find module './applySourceMap' on ng serve or ng build #16493

Closed
2 of 15 tasks
blakeghowe opened this issue Dec 23, 2019 · 9 comments
Closed
2 of 15 tasks

Cannot find module './applySourceMap' on ng serve or ng build #16493

blakeghowe opened this issue Dec 23, 2019 · 9 comments
Labels
needs: more info Reporter must clarify the issue

Comments

@blakeghowe
Copy link

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • xi18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Unsure

Description

If I use ng serve or ng build, I get the following error message:
An unhandled exception occurred: Cannot find module './applySourceMap' See "C:\Users\[USER]\AppData\Local\Temp\ng-aEMkei\angular-errors.log" for further details.

🔬 Minimal Reproduction

🔥 Exception or Error




[error] Error: Cannot find module './applySourceMap'
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
    at Function.Module._load (internal/modules/cjs/loader.js:508:25)
    at Module.require (internal/modules/cjs/loader.js:637:17)
    at require (internal/modules/cjs/helpers.js:22:18)
    at Object. (C:\Users\[USER]\source\repos\[PROJECT]\Angular_nstt\node_modules\webpack-sources\lib\SourceMapSource.js:13:22)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)

🌍 Your Environment




Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.801.0
@angular-devkit/build-angular     0.803.21
@angular-devkit/build-optimizer   0.803.21
@angular-devkit/build-webpack     0.803.21
@angular-devkit/core              8.1.0
@angular-devkit/schematics        8.1.0
@angular/animations               8.1.3
@angular/cdk                      8.1.1
@angular/http                     2.3.0
@angular/material                 8.1.2
@angular/platform-browser         8.1.3
@angular/tsc-wrapped              0.4.2
@ngtools/webpack                  8.3.21
@schematics/angular               8.1.0
@schematics/update                0.801.0
rxjs                              6.5.2
typescript                        3.4.5
webpack                           4.39.2

Anything else relevant?

@sacgrover
Copy link
Contributor

Seems like. You didn't import applySourceMap module into App Module

@alan-agius4
Copy link
Collaborator

Hi @blakeghowe, this might be caused by a package manger hosting issue. I am seeing also a number of package versions which are not aligned.

Can you update your @angular/cli version to ^8.3.21 and try again?

@alan-agius4 alan-agius4 added the needs: more info Reporter must clarify the issue label Dec 27, 2019
@philoj
Copy link

philoj commented Dec 31, 2019

@alan-agius4 Having same issue here. I updated the cli to 8.3.21, still having the issue
@blakeghowe did you find a solution?

@alan-agius4
Copy link
Collaborator

Can you run npm ls webpack-sources?

@frontend-stunntech
Copy link

Can you run npm ls webpack-sources?

Hi @alan-agius4 ,
I get the following
└─┬ @angular-devkit/[email protected]
├─┬ @angular-devkit/[email protected]
│ └── [email protected] deduped
├─┬ @ngtools/[email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
├─┬ [email protected]
│ └── [email protected] deduped
└── [email protected]

@clydin
Copy link
Member

clydin commented Jan 3, 2020

You may have a corrupted install. The JavaScript file in question (applySourceMap.js) should be located adjacent to the SourceMapSource.js mentioned in the stack trace. (package contents)

Can you check whether the file applySourceMap.js is present in the node_modules\webpack-sources\lib\ directory?
Also it may be useful to try deleting the node_modules directory and lock file and then re-installing. If the problem persists, removing the local npm cache prior to the re-install may help (npm cache clean --force).

@frontend-stunntech
Copy link

You may have a corrupted install. The JavaScript file in question (applySourceMap.js) should be located adjacent to the SourceMapSource.js mentioned in the stack trace. (package contents)

Can you check whether the file applySourceMap.js is present in the node_modules\webpack-sources\lib\ directory?
Also it may be useful to try deleting the node_modules directory and lock file and then re-installing. If the problem persists, removing the local npm cache prior to the re-install may help (npm cache clean --force).

Thanks, @clydin,
applySourceMap.js was missing in the directory node_modules\webpack-sources\lib\.
Now its working fine when deleting `node-modules' and lock file and then reinstalling

@filipesilva
Copy link
Contributor

Glad to hear it's sorted, I'll close the issue then.

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Feb 3, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue
Projects
None yet
Development

No branches or pull requests

7 participants