@ angular-cli ng serve livereload不起作用

时间:2017-04-06 12:12:16

标签: angular angular-cli

我是Angular2和@ angular-cli的新手。我下载@ angular-cli,我尝试将它与livereload一起使用,但不起作用。我试图在版本1.4.2下降,但仍然无法正常工作。

我有这个失败:

ERROR in ./src/main.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (/home/cesar/Repositorios/proyectoAlbum/client-albums/node_modules/typescript/lib/typescript.js:9514:20)
    at Object.createCompilerHost (/home/cesar/Repositorios/proyectoAlbum/client-albums/node_modules/typescript/lib/typescript.js:63770:26)
    at Object.ngcLoader (/home/cesar/Repositorios/proyectoAlbum/client-albums/node_modules/@ngtools/webpack/src/loader.js:380:33)
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts

ERROR in ./src/polyfills.ts
Module build failed: TypeError: Cannot read property 'newLine' of undefined
    at Object.getNewLineCharacter (/home/cesar/Repositorios/proyectoAlbum/client-albums/node_modules/typescript/lib/typescript.js:9514:20)
    at Object.createCompilerHost (/home/cesar/Repositorios/proyectoAlbum/client-albums/node_modules/typescript/lib/typescript.js:63770:26)
    at Object.ngcLoader (/home/cesar/Repositorios/proyectoAlbum/client-albums/node_modules/@ngtools/webpack/src/loader.js:380:33)
 @ multi ./src/polyfills.ts

这是我的@ angular-cli和节点

的版本
   / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
  / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
 / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
/_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
               |___/
@angular/cli: 1.0.0
node: 6.10.2
os: linux x64
@angular/common: 4.0.1
@angular/compiler: 4.0.1
@angular/core: 4.0.1
@angular/forms: 4.0.1
@angular/http: 4.0.1
@angular/platform-browser: 4.0.1
@angular/platform-browser-dynamic: 4.0.1
@angular/router: 4.0.1
@angular/cli: 1.0.0
@angular/compiler-cli: 4.0.1

此致!!

1 个答案:

答案 0 :(得分:0)

您没有正确升级。 NGtools绑定设置不正确。

请按照以下步骤操作:https://github.com/angular/angular-cli#updating-angular-cli

另外:

  

要求节点6.9.0或更高版本,以及NPM 3或更高版本。

您可以在此处下载最新版本:https://nodejs.org/en/。 它对我来说是正常的。