angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

@ngtools/webpack 1.7.3.TypeError: ts.createModuleResolutionCache is not a function

Open Liyuze1994 opened this issue 9 years ago • 17 comments

hello I used angular-cli to build my project

I can build succeed three days ago. But I get wrong today. I saw ngtools/webpack is updated. use angular-cli: 1.0.0-beta.28.3 use ngtools/webpack 1.7.3 I got error 。

ts.createModuleResolutionCache is not a function TypeError: ts.createModuleResolutionCache is not a function at AotPlugin._setupOptions (/workspace/angularjs/node_modules/.1.7.3@@ngtools/webpack/src/plugin.js:146:42) at new AotPlugin (/workspace/angularjs/node_modules/.1.7.3@@ngtools/webpack/src/plugin.js:30:14) at Object.exports.getNonAotConfig (/workspace/angularjs/node_modules/.1.0.0-beta.28.3@angular-cli/models/webpack-configs/typescript.js:26:13) at new NgCliWebpackConfig (/workspace/angularjs/node_modules/.1.0.0-beta.28.3@angular-cli/models/webpack-config.js:24:37) at Class.run (/workspace/angularjs/node_modules/.1.0.0-beta.28.3@angular-cli/tasks/build.js:16:29) at Class.buildRun (/workspace/angularjs/node_modules/.1.0.0-beta.28.3@angular-cli/commands/build.run.js:12:22) at Class.run (/workspace/angularjs/node_modules/.1.0.0-beta.28.3@angular-cli/commands/build.js:40:47) at Class. (/workspace/angularjs/node_modules/.1.0.0-beta.28.3@angular-cli/ember-cli/lib/models/command.js:134:17) at at process._tickCallback (internal/process/next_tick.js:188:7)

I changed the ngtools/webpack to 1.7.1 is right.

Liyuze1994 avatar Oct 12 '17 11:10 Liyuze1994

The CLI version used is quite outdated. The current stable version is 1.4.6. Note also that the package name changed during the 1.0-beta phase to @angular/cli.

clydin avatar Oct 12 '17 12:10 clydin

i have a error but donno how fix it, delete so many times "node_modules" and reinstall nothing change always same error.



ERROR in TypeError: Cannot use 'in' operator to search for 'providers' in null
    at C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:111:73
    at Array.filter (native)
    at _extractLazyRoutesFromStaticModule (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:111:29)
    at C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:129:27
    at Array.reduce (native)
    at _extractLazyRoutesFromStaticModule (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:128:10)
    at includeLazyRouteAndSubRoutes (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:66:25)
    at Array.reduce (native)
    at includeLazyRouteAndSubRoutes (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:67:26)
    at Array.reduce (native)
    at Object.listLazyRoutesOfModule (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_impl.js:54:36)
    at Function.NgTools_InternalApi_NG_2.listLazyRoutes (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\compiler-cli\src\ngtools_api.js:91:39)
    at AotPlugin._getLazyRoutesFromNgtools (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\plugin.js:207:44)
    at _donePromise.Promise.resolve.then.then.then.then.then (C:\Users\iii\WebstormProjects\iii\node_modules\@angular\cli\node_modules\@ngtools\webpack\src\plugin.js:443:24)
    at process._tickCallback (internal/process/next_tick.js:109:7)

elvisbegovic avatar Oct 12 '17 13:10 elvisbegovic

@istiti that seems like a different problem. Can you open a new issue and include all details in the issue template please?

filipesilva avatar Oct 12 '17 13:10 filipesilva

done https://github.com/angular/angular-cli/issues/8025

cc @filipesilva

elvisbegovic avatar Oct 12 '17 13:10 elvisbegovic

same issue here ..

mradham avatar Oct 12 '17 13:10 mradham

Can you provide the TypeScript version used with the project?

clydin avatar Oct 12 '17 13:10 clydin

have to say I'm not too happy about this....

using angular cli 1.0.0-beta.25.5 angular 2.4.3 typescript 2.0.3

and now a breaking change in webpack causes all my builds to fail.

TylerDev6 avatar Oct 12 '17 14:10 TylerDev6

@TylerDev6 can you try updating typescript to 2.1 please?

filipesilva avatar Oct 12 '17 14:10 filipesilva

@filipesilva will do.

TylerDev6 avatar Oct 12 '17 14:10 TylerDev6

@filipesilva did the trick.

TylerDev6 avatar Oct 12 '17 14:10 TylerDev6

Glad to hear it. That's the workaround for now, we're looking at our options to address this.

filipesilva avatar Oct 12 '17 14:10 filipesilva

@filipesilva correction.... moving straight to 2.1.0 fails with

AppModule is not an NgModule

moving to ~2.0.3 fixed it though

TylerDev6 avatar Oct 12 '17 14:10 TylerDev6

For those who have the same issue but running the latest angular cli (1.4.6), just update your typescript version (I installed ~2.5.3, and worked correctly). Maybe after the update you have to make a few changes on your code, because of type errors that the older typescript version did not check or notice about.

MiguelLattuada avatar Oct 12 '17 14:10 MiguelLattuada

step:1 Update your angular CLI using this sudo npm install --save-dev @angular/cli@latest

step:2 In Mac, press Shift+Command+H then select the Home option. Now select package.json,package-lock.json file and delete both the files.

step:3 Restart your terminal and then it will work.

RanjithRana avatar Oct 12 '17 17:10 RanjithRana

@ngtools/webpack 1.7.4 has been released with a fix that handles the lack of certain functionality in TS versions less than 2.1.5.

@RanjithRana just a quick comment that running npm with sudo is dangerous and should not be necessary. (check out nvm for managing node installations).

clydin avatar Oct 12 '17 17:10 clydin

This has been fixed in #8028 .

hansl avatar Oct 12 '17 17:10 hansl

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.