Skip to content

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

Closed

Description

@blakeghowe

🐞 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?

Activity

  1. sacgrover commented on Dec 24, 2019

    @sacgrover
    Contributor

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

  2. alan-agius4 commented on Dec 27, 2019

    @alan-agius4
    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?

  3. philoj commented on Dec 31, 2019

    @philoj

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

  4. alan-agius4 commented on Dec 31, 2019

    @alan-agius4
    Collaborator

    Can you run npm ls webpack-sources?

  5. frontend-stunntech commented on Jan 1, 2020

    @frontend-stunntech

    Can you run npm ls webpack-sources?

    Hi @alan-agius4 ,
    I get the following
    └─┬ @angular-devkit/build-angular@0.803.21
    ├─┬ @angular-devkit/build-optimizer@0.803.21
    │ └── webpack-sources@1.4.3 deduped
    ├─┬ @ngtools/webpack@8.3.21
    │ └── webpack-sources@1.4.3 deduped
    ├─┬ license-webpack-plugin@2.1.2
    │ └── webpack-sources@1.4.3 deduped
    ├─┬ mini-css-extract-plugin@0.8.0
    │ └── webpack-sources@1.4.3 deduped
    ├─┬ terser-webpack-plugin@1.4.3
    │ └── webpack-sources@1.4.3 deduped
    ├─┬ webpack@4.39.2
    │ └── webpack-sources@1.4.3 deduped
    └── webpack-sources@1.4.3

  6. clydin commented on Jan 3, 2020

    @clydin
    Member

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

  7. frontend-stunntech commented on Jan 3, 2020

    @frontend-stunntech

    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

  8. filipesilva commented on Jan 3, 2020

    @filipesilva
    Contributor

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

  9. angular-automatic-lock-bot commented on Feb 3, 2020

    @angular-automatic-lock-bot

    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.

  10. locked and limited conversation to collaborators on Feb 3, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions