Angular-cli: Cannot find module 'enhanced-resolve' [windows 10, yarn]

Created on 5 Dec 2016  路  6Comments  路  Source: angular/angular-cli

OS?

Windows 10

Versions.

angular-cli: 1.0.0-beta.20-3
node: 6.5.0
os: win32 x64

Repro steps.

# Upgrade to beta.20-4
yarn upgrade [email protected]
# checking the version already throws the below exception
ng --version

The log given by the failure.

Cannot find module 'enhanced-resolve/lib/getInnerRequest'
Error: Cannot find module 'enhanced-resolve/lib/getInnerRequest'
    at Function.Module._resolveFilename (module.js:455:15)
    at Function.Module._load (module.js:403:25)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\@ngtools\webpack\src\paths-plugin.js:6:23)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\@ngtools\webpack\src\plugin.js:14:22)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\@ngtools\webpack\src\index.js:6:10)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\models\webpack-build-typescript.js:5:17)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\models\webpack-config.js:2:34)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\tasks\build-webpack.js:6:24)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\commands\build.js:3:23)
    at Module._compile (module.js:556:32)
    at Object.Module._extensions..js (module.js:565:10)
    at Module.load (module.js:473:32)
    at tryModuleLoad (module.js:432:12)
    at Function.Module._load (module.js:424:3)
    at Module.require (module.js:483:17)
    at require (internal/module.js:20:19)
    at Class.includedCommands (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\addon\index.js:21:16)
    at C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\angular-cli\lib\models\project.js:392:61
    at Array.forEach (native)
    at Project.addonCommands (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\angular-cli\lib\models\project.js:391:15)
    at Project.eachAddonCommand (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\angular-cli\lib\models\project.js:426:30)
    at module.exports (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\angular-cli\lib\cli\lookup-command.js:33:13)
    at CLI.<anonymous> (C:\development\projects\cf-mantis\mantis-client\node_modules\angular-cli\angular-cli\lib\cli\cli.js:34:26)
    at tryCatch (C:\development\projects\cf-mantis\mantis-client\node_modules\rsvp\dist\rsvp.js:538:12)
    at invokeCallback (C:\development\projects\cf-mantis\mantis-client\node_modules\rsvp\dist\rsvp.js:553:13)
    at publish (C:\development\projects\cf-mantis\mantis-client\node_modules\rsvp\dist\rsvp.js:521:7)
    at flush (C:\development\projects\cf-mantis\mantis-client\node_modules\rsvp\dist\rsvp.js:2373:5)
    at _combinedTickCallback (internal/process/next_tick.js:67:7)
    at process._tickCallback (internal/process/next_tick.js:98:9)

Mention any other details that might be useful.

The problem seems to be related to yarn install, as installing with npm install does not rise an exception.

Most helpful comment

I'm getting the same error using npm (not yarn) when trying to use @ngtools/webpack in a project that doesn't use the Angular CLI.

Installing enhanced-resolve fixes it.

So perhaps the problem is that @ngtools/webpack doesn't declare enhanced-resolve in its dependencies?

All 6 comments

We haven't officially supported yarn yet. Many users are saying it works, but we'd need a lot more experimentation before we can commit to investigate those bugs. It's on our plate for RC, so stay tuned. Closing this for now.

That's strangely the error I'm getting on 1.0.0-beta.22-1 (working fine for 1.0.0-beta.20-4). However not when I install it, but when I run it (ng build --prod --aot). Not sure whether that's related or I shall open a new issue for this ...

I'm getting the same error on ng serve on beta.21. Used to work on beta 20.4. After running

npm install enhanced-resolve

ng serve started working.

I guess, this is the yarn issue.

There is open issue on yarn repository about this too https://github.com/yarnpkg/yarn/issues/785

I'm getting the same error using npm (not yarn) when trying to use @ngtools/webpack in a project that doesn't use the Angular CLI.

Installing enhanced-resolve fixes it.

So perhaps the problem is that @ngtools/webpack doesn't declare enhanced-resolve in its dependencies?

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

Was this page helpful?
0 / 5 - 0 ratings

Related issues

IngvarKofoed picture IngvarKofoed  路  3Comments

jmurphzyo picture jmurphzyo  路  3Comments

brtnshrdr picture brtnshrdr  路  3Comments

ericel picture ericel  路  3Comments

hareeshav picture hareeshav  路  3Comments