Angular-cli: Can not build project created with cli

Created on 25 Jan 2017  ·  10Comments  ·  Source: angular/angular-cli

OS: Windows 10 Pro x64
CLI Versions: 1.0.0-beta.26
Node Version: 5.11.0

Created a new project via the following:

ng init --routing --style=scss --link-cli

Tried to build via the following:

ng build

The following is the stack trace:

ERROR in ./src/main.ts Module build failed: TypeError: Cannot read property 'newLine' of undefined at Object.getNewLineCharacter (D:\andromeda-prototype\node_modules\typescript\lib\typescript.js:8062:20) at Object.createCompilerHost (D:\andromeda-prototype\node_modules\typescript\lib\typescript.js:44978:26) at Object.ngcLoader (D:\andromeda-prototype\node_modules\@ngtools\webpack\src\loader.js:202:31) @ multi ./src/main.ts

No files were changed, updated cli to latest version as per docs but still same issue.

All 10 comments

@martinfletcher try again using ng new rather then ng init. init should be used to upgrade (I believe it is even being renamed as such).

@martinfletcher I see you're using the --link-cli option, is this because you are running angular-cli from the master branch? If not, you don't need that option.

@deebloo, @beeman Thanks, used ng new without --link-cli and work great!

Slight confusion with the docs for the CLI, as there is no mention that ng init should not be used for new projects.

Also, ng new will not allow for a new project to be created inside of an existing directory, tried using --directory=. but errors as directory already exists. This may be a problem (as it was for me) when using base solution directory templates.

@martinfletcher cool that you got it working. So ng new creates a new directory, ng init starts a project in the current directory. That's about the only difference (that I know of)

@beeman, @martinfletcher cool didn't realize thats all init did

@beeman ng init was causing the same issue for me, even without the --link-cli option

@martinfletcher this is what my test shows, seems to work:

~/workspace/angular-cli/scratch
❯ mkdir issue-4224

~/workspace/angular-cli/scratch
❯ cd issue-4224

~/workspace/angular-cli/scratch/issue-4224
❯ ng init --routing --style=scss
installing ng2
  create .editorconfig
  create README.md
  create src/app/app-routing.module.ts
  create src/app/app.component.scss
  create src/app/app.component.html
  create src/app/app.component.spec.ts
  create src/app/app.component.ts
  create src/app/app.module.ts
  create src/assets/.gitkeep
  create src/environments/environment.prod.ts
  create src/environments/environment.ts
  create src/favicon.ico
  create src/index.html
  create src/main.ts
  create src/polyfills.ts
  create src/styles.scss
  create src/test.ts
  create src/tsconfig.json
  create angular-cli.json
  create e2e/app.e2e-spec.ts
  create e2e/app.po.ts
  create e2e/tsconfig.json
  create .gitignore
  create karma.conf.js
  create package.json
  create protractor.conf.js
  create tslint.json
Successfully initialized git.
Installing packages for tooling via npm.
Installed packages for tooling via npm.
Project 'issue-4224' successfully created.

~/workspace/angular-cli/scratch/issue-4224 master 2m 8s
❯ ng build
Hash: 57c4cedf7f910f0a4356
Time: 4729ms
chunk    {0} main.bundle.js, main.bundle.map (main) 5.55 kB {2} [initial] [rendered]
chunk    {1} styles.bundle.css, styles.bundle.map, styles.bundle.map (styles) 1.77 kB {3} [initial] [rendered]
chunk    {2} vendor.bundle.js, vendor.bundle.map (vendor) 2.7 MB [initial] [rendered]
chunk    {3} inline.bundle.js, inline.bundle.map (inline) 0 bytes [entry] [rendered]

@beeman alas, file permissions! yeah that's working for me now too :)

Issue resolved, closing.

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

rwillmer picture rwillmer  ·  3Comments

brtnshrdr picture brtnshrdr  ·  3Comments

daBishMan picture daBishMan  ·  3Comments

hartjo picture hartjo  ·  3Comments

gotschmarcel picture gotschmarcel  ·  3Comments