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

Getting Errror In Angular-CLI SSR

Open kamzk opened this issue 8 years ago • 3 comments

Hi, I tried all the steps from https://github.com/angular/angular-cli/wiki/stories-universal-rendering

After running this command npm run build:ssr && npm run serve:ssr, got the below error:

`ERROR in ./server.ts Module build failed: TypeError: Cannot read property 'afterCompile' of undefined

at successfulTypeScriptInstance (D:\ssr\node_modules\ts-loader\dist\instance

s.js:147:28) at Object.getTypeScriptInstance (D:\ssr\node_modules\ts-loader\dist\instance s.js:48:12) at Object.loader (D:\ssr\node_modules\ts-loader\dist\index.js:16:41) npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! [email protected] webpack:server: webpack --config webpack.server.config.js -- progress --colors npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] webpack:server script. npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\eshiksha\AppData\Roaming\npm-cache_logs\2018-03-08T07_46_ 29_034Z-debug.log npm ERR! code ELIFECYCLE npm ERR! errno 2 npm ERR! [email protected] build:ssr: npm run build:client-and-server-bundles && npm ru n webpack:server npm ERR! Exit status 2 npm ERR! npm ERR! Failed at the [email protected] build:ssr script. npm ERR! This is probably not a problem with npm. There is likely additional log ging output above.

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\eshiksha\AppData\Roaming\npm-cache_logs\2018-03-08T07_46_ 29_091Z-debug.log`

kamzk avatar Mar 08 '18 07:03 kamzk

https://github.com/TypeStrong/ts-loader/releases/tag/v4.0.0

I think this is because TypeScript dropped support for webpack 2/3, as pointed out by @georgebonney in #9783 .

Downgrading to ts-loader 3.5.0 should temporarily solve this problem

Hayden-Yu avatar Mar 08 '18 19:03 Hayden-Yu

@Hayden-Yu Yes you are right, it worked on ts-loader 3.5.0

kamzk avatar Mar 11 '18 09:03 kamzk

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.