Skip to content

Can't create new Angular project with angular-cli #9129

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
zmbq opened this issue Jan 8, 2018 · 12 comments
Closed

Can't create new Angular project with angular-cli #9129

zmbq opened this issue Jan 8, 2018 · 12 comments
Assignees
Labels
needs: more info Reporter must clarify the issue P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix

Comments

@zmbq
Copy link

zmbq commented Jan 8, 2018

I've installed @angular/cli version 1.6.3 and then did:

ng new frontend --routing
cd frontend
ng build

I got an error saying main.ts and polyfills.ts are not included in tsconfig.json .

I've seen two issues on the matter, one was about ts placed in the wrong place, the other was closed as a duplicate of the first. This is clearly not the same case - I did not create any ts files, and all I need to do is run that series of commands and get the exact same behavior. This happens on several of our development machines (all with Windows 10)

Versions

Angular CLI: 1.6.3
Node: 8.9.3
OS: win32 x64
Angular: 5.1.3
... animations, common, compiler, compiler-cli, core, forms
... http, language-service, platform-browser
... platform-browser-dynamic, router

@angular/cli: 1.6.3
@angular-devkit/build-optimizer: 0.0.36
@angular-devkit/core: 0.0.22
@angular-devkit/schematics: 0.0.42
@ngtools/json-schema: 1.1.0
@ngtools/webpack: 1.9.3
@schematics/angular: 0.1.11
@schematics/schematics: 0.0.11
typescript: 2.4.2
webpack: 3.10.0

Repro steps

    ng new frontend --routing
    cd frontend
    ng build

Observed behavior

The following errors:

ERROR in d:/chelem/ShalevItzkovitz/Interactions/frontend/src/main.ts
Module build failed: Error: d:\chelem\ShalevItzkovitz\Interactions\frontend\src\main.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtools\webpack\src\angular_compiler_plugin.js:653:23)
    at plugin.done.then (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtools\webpack\src\loader.js:467:39)
    at <anonymous> @ multi ./src/main.ts

ERROR in d:/chelem/ShalevItzkovitz/Interactions/frontend/src/polyfills.ts
Module build failed: Error: d:\chelem\ShalevItzkovitz\Interactions\frontend\src\polyfills.ts is missing from the TypeScript compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (d:\chelem\ShalevItzkovitz\Interactions\frontendnode_modules\@ngtools\webpack\src\angular_compiler_plugin.js:653:23)
    at plugin.done.then (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtoolswebpack\src\loader.js:467:39)
    at <anonymous> @ multi ./src/polyfills.ts

Desired behavior

ng new should create a project that can be built and served.

@clydin clydin added P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix labels Jan 8, 2018
@filipesilva
Copy link
Contributor

@zmbq just to confirm, you're saying that ng new does not create the TS files right? Can you show me the console output from running ng new appname please?

Yesterday I also saw an odd problem with a generator where files were not created on Windows 10. I'm guessing it's a similar problem, but seeing the log for ng new would help.

@filipesilva filipesilva added the needs: more info Reporter must clarify the issue label Jan 9, 2018
@zmbq
Copy link
Author

zmbq commented Jan 9, 2018

C:\Users\itay\sources\ShalevItzkovitz\Interactions [master] > ng new frontend --routing --style=scss
  create frontend/e2e/app.e2e-spec.ts (290 bytes)
  create frontend/e2e/app.po.ts (208 bytes)
  create frontend/e2e/tsconfig.e2e.json (235 bytes)
  create frontend/karma.conf.js (923 bytes)
  create frontend/package.json (1320 bytes)
  create frontend/protractor.conf.js (722 bytes)
  create frontend/README.md (1024 bytes)
  create frontend/tsconfig.json (363 bytes)
  create frontend/tslint.json (3040 bytes)
  create frontend/.angular-cli.json (1245 bytes)
  create frontend/.editorconfig (245 bytes)
  create frontend/.gitignore (516 bytes)
  create frontend/src/assets/.gitkeep (0 bytes)
  create frontend/src/environments/environment.prod.ts (51 bytes)
  create frontend/src/environments/environment.ts (387 bytes)
  create frontend/src/favicon.ico (5430 bytes)
  create frontend/src/index.html (295 bytes)
  create frontend/src/main.ts (370 bytes)
  create frontend/src/polyfills.ts (2405 bytes)
  create frontend/src/styles.scss (80 bytes)
  create frontend/src/test.ts (1085 bytes)
  create frontend/src/tsconfig.app.json (211 bytes)
  create frontend/src/tsconfig.spec.json (304 bytes)
  create frontend/src/typings.d.ts (104 bytes)
  create frontend/src/app/app-routing.module.ts (245 bytes)
  create frontend/src/app/app.module.ts (395 bytes)
  create frontend/src/app/app.component.html (1173 bytes)
  create frontend/src/app/app.component.spec.ts (1103 bytes)
  create frontend/src/app/app.component.ts (208 bytes)
  create frontend/src/app/app.component.scss (0 bytes)
Installing packages for tooling via yarn.
yarn install v1.3.2
info No lockfile found.
[1/4] Resolving packages...
[2/4] Fetching packages...
info fsevents@1.1.3: The platform "win32" is incompatible with this module.
info "fsevents@1.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "@angular/cli > @angular-devkit/schematics > @schematics/schematics@0.0.11" has unmet peer dependency "@angular-
devkit/core@0.0.22".
[4/4] Building fresh packages...
success Saved lockfile.
Done in 64.65s.
Installed packages for tooling via yarn.
Directory is already under version control. Skipping initialization of git.
Project 'frontend' successfully created.

@zmbq
Copy link
Author

zmbq commented Jan 9, 2018

Here is the output of ng build:

C:\Users\itay\sources\ShalevItzkovitz\Interactions\frontend [master] > ng build
Date: 2018-01-09T13:00:45.702Z
Hash: a73c63c6ee645ae53d98
Time: 2180ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 867 bytes [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 892 bytes [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 3.02 kB [initial] [rendered]

ERROR in d:/chelem/ShalevItzkovitz/Interactions/frontend/src/main.ts
Module build failed: Error: d:\chelem\ShalevItzkovitz\Interactions\frontend\src\main.ts is missing from the TypeScript c
ompilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtools\webp
ack\src\angular_compiler_plugin.js:653:23)
    at plugin.done.then (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtools\webpack\src\loader.js:467
:39)
    at <anonymous>
 @ multi ./src/main.ts
ERROR in d:/chelem/ShalevItzkovitz/Interactions/frontend/src/polyfills.ts
Module build failed: Error: d:\chelem\ShalevItzkovitz\Interactions\frontend\src\polyfills.ts is missing from the TypeScr
ipt compilation. Please make sure it is in your tsconfig via the 'files' or 'include' property.
    at AngularCompilerPlugin.getCompiledFile (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtools\webp
ack\src\angular_compiler_plugin.js:653:23)
    at plugin.done.then (d:\chelem\ShalevItzkovitz\Interactions\frontend\node_modules\@ngtools\webpack\src\loader.js:467
:39)
    at <anonymous>
 @ multi ./src/polyfills.ts

@filipesilva
Copy link
Contributor

@zmbq and you don't have the src/main.ts file after ng new, correct?

@zmbq
Copy link
Author

zmbq commented Jan 9, 2018

@filipesilva , I do have src/main.ts . I'm attaching a file with the entire content of the directory created by ng new (I just removed node_modules from the zip file)

frontend.zip

@filipesilva
Copy link
Contributor

I'm sorry but I cannot reproduce what you're seeing... I downloaded your file, ran npm install and then npm run ng -- build and it built correctly:

kamik@T460p MINGW64 D:/sandbox/frontend
$ npm run ng -- build

> frontend@0.0.0 ng D:\sandbox\frontend
> ng "build"

Date: 2018-01-09T13:31:27.310Z
Hash: f520f53812d927e1da2e
Time: 7503ms
chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered]
chunk {main} main.bundle.js, main.bundle.js.map (main) 9.67 kB [initial] [rendered]
chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 202 kB [initial] [rendered]
chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 11.7 kB [initial] [rendered]
chunk {vendor} vendor.bundle.js, vendor.bundle.js.map (vendor) 2.73 MB [initial] [rendered]

Do you have symlinks or juntions in that path? I'm looking at the log you posted and the error is shown in a different folder than the one you run the commands from.

If so then the bug you are running into is #8603.

@zmbq
Copy link
Author

zmbq commented Jan 9, 2018 via email

@filipesilva
Copy link
Contributor

Maybe at the time you had a version of Angular CLI with a bug that prevented it from working. I'll close as a duplicate of #8603 then.

@zmbq
Copy link
Author

zmbq commented Jan 9, 2018

It was definitely version 1.6.3, as well. Oh well.

@Caiuse
Copy link

Caiuse commented Feb 7, 2018

I had this bug today, running with –preserve-symlinks worked but without it would not build. I was running with from windows cmd. I think there is still a problem.

@r-havelka
Copy link

I was having this same bug for a couple hours. I found out that I was in the wrong working directory.
my directory: ~/My Documents/Github/MyProject/client
correct directory: ~/Documents/Github/MyProject/client

@angular-automatic-lock-bot
Copy link

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.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 7, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
needs: more info Reporter must clarify the issue P1 Impacts a large percentage of users; if a workaround exists it is partial or overly painful type: bug/fix
Projects
None yet
Development

No branches or pull requests

5 participants