Cannot read property 'run' of undefined (awesome-typescript-loader)

411 Views Asked by At

I'm attempting to update our angular 5 application to angular 6, and am running into a build issue currently with awesome-typescript loader.

The full error message is

C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5
                compiler.hooks.run.tapAsync('at-loader', function(params, callback) {
                 ^
TypeError: Cannot read property 'run' of undefined
    at CheckerPlugin.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\awesome-typescript-loader\src\watch-mode.ts:5:18)
    at Compiler.apply (C:\source\ProjectFolder\Angular.Web.App\node_modules\tapable\lib\Tapable.js:375:16)
    at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:33:19)
    at options.map.options (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:55)
    at Array.map (<anonymous>)
    at webpack (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\lib\webpack.js:23:40)
    at processOptions (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:335:15)
    at yargs.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:397:2)
    at Object.Yargs.self.parse (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\node_modules\yargs\yargs.js:533:18)
    at Object.<anonymous> (C:\source\ProjectFolder\Angular.Web.App\node_modules\webpack\bin\webpack.js:152:7)
    at Module._compile (module.js:643:30)
    at Object.Module._extensions..js (module.js:654:10)
    at Module.load (module.js:556:32)
    at tryModuleLoad (module.js:499:12)
    at Function.Module._load (module.js:491:3)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:webpack: `webpack --progress --color`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:webpack script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_890Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:dev: `npm run build:vendor && npm run build:webpack`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\UserAccount\AppData\Roaming\npm-cache\_logs\2019-06-20T21_07_09_936Z-debug.log

it is required, as our webpack is pulling in its CheckerPlugin

const CheckerPlugin = require('awesome-typescript-loader').CheckerPlugin;

module.exports = (env) => {
    // Configuration in common to both client-side and server-side bundles
    const isDevBuild = !(env && env.prod);
    const sharedConfig = {
        stats: { modules: false },
        context: __dirname,
        resolve: { extensions: [ '.js', '.ts' ] },
        output: {
            filename: '[name].js',
            publicPath: 'dist/' // Webpack dev middleware, if enabled, handles requests for this URL prefix
        },
        module: {
            rules: [
                { test: /\.ts$/, use: isDevBuild ? ['angular2-template-loader', 'angular2-router-loader'] : '@ngtools/webpack' },
                { test: /\.html$/, use: 'html-loader?minimize=false' },
                { test: /\.css$/, use: [ 'to-string-loader', isDevBuild ? 'css-loader' : 'css-loader?minimize' ] },
                { test: /\.(png|jpg|jpeg|gif|svg)$/, use: 'url-loader?limit=25000' },
                ...sharedModuleRules
            ]
        },
        plugins: [new CheckerPlugin()]
    };

currenlty using awesome-typescript-loader v. 5.0.0

0

There are 0 best solutions below