Angular-cli: Cannot read property 'newLine' of undefined

Created on 27 Feb 2017  路  6Comments  路  Source: angular/angular-cli

OS?

Windows 10

Versions.

@angular/cli: 1.0.0-beta.32.3
node: 7.5.0
os: win32 x64
@angular/common: 2.4.8
@angular/compiler: 2.4.8
@angular/core: 2.4.8
@angular/forms: 2.4.8
@angular/http: 2.4.8
@angular/platform-browser: 2.4.8
@angular/platform-browser-dynamic: 2.4.8
@angular/router: 3.2.3
@angular/material: 2.0.0-beta.1
@angular/cli: 1.0.0-beta.32.3
@angular/compiler-cli: 2.4.8
@ngtools/webpack: 1.1.9

The log given by the failure.

ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (....\node_modules\typescript\lib\
typescript.js:8062:20)
at Object.createCompilerHost (.......\node_modules\typescript\lib\t
ypescript.js:44978:26)
at Object.ngcLoader (.......\node_modules\@ngtools\webpack\src\load
er.js:170:31)
@ multi ./src/main.ts

ERROR in ./src/polyfills.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (...\node_modules\typescrip
t\lib\typescript.js:8062:20)
at Object.createCompilerHost (....\node_modules\typescript
\lib\typescript.js:44978:26)
at Object.ngcLoader (...\node_modules\@ngtools\webpack\sr
c\loader.js:170:31)
@ multi ./src/polyfills.ts

Tried rimraf node_modules-> npm cache clean -> npm i. The files are the same as in the new project, that works with NG new.

Its super small project, and all files from the new one are the same.

Most helpful comment

@udaantech Have you managed to solve your issue yet? I'm getting this issue in CircleCI but it works perfectly locally.

All 6 comments

CLosed. I had referenced Older version of @ngtools/webpack in devDependencies from past.

I am getting similar type of error:

throw new Error("Module build failed: TypeError: Cannot read property 'newLine' of undefined\n at Object.getNew
LineCharacter (..../node_modules/typescript/lib/typescript.js:8062:20)\n
at Object.createCompilerHost ...../node_modules/typescript/lib/types
cript.js:44978:26)\n at Object.ngcLoader (..../node_modules/@ngtools/
webpack/src/loader.js:202:31)");
^

Error: Module build failed: TypeError: Cannot read property 'newLine' of undefined
at Object.getNewLineCharacter (..../node_modules/typescript/lib/type
script.js:8062:20)
at Object.createCompilerHost (..../node_modules/typescript/lib/types
cript.js:44978:26)
at Object.ngcLoader (.../node_modules/@ngtools/webpack/src/loader.j
s:202:31)
at Object. (...../dist/server/server.bundle.js:72:7)
at __webpack_require__ (..../server/server.bundle.js:21:30)
at Object. (..../dist/server/server.bundle.js:79:18)
at __webpack_require__ (..../dist/server/server.bundle.js:21:30)
at.../dist/server/server.bundle.js:65:18
at Object. (...../dist/server/server.bundle.js:68:10)
at Module._compile (module.js:435:26)
at Object.Module._extensions..js (module.js:442:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:311:12)

I am using angular universal for existing project .Can any one suggest how to debug this error ?

@udaantech Have you managed to solve your issue yet? I'm getting this issue in CircleCI but it works perfectly locally.

Same as @astriddg. Getting this in CircleCI, but only after upgrading to ng4

Actually, I found something else online. Seems like if you nombom locally or clear your CircleCI caches, then it fixes itself. Worked for me at least.

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

jmurphzyo picture jmurphzyo  路  3Comments

rwillmer picture rwillmer  路  3Comments

MateenKadwaikar picture MateenKadwaikar  路  3Comments

hartjo picture hartjo  路  3Comments

sysmat picture sysmat  路  3Comments