Skip to content
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

Angular-CLI 14.0.0-rc.0 failed to generate new component #23141

Closed
1 of 15 tasks
s-triar opened this issue May 16, 2022 · 6 comments · Fixed by #23149
Closed
1 of 15 tasks

Angular-CLI 14.0.0-rc.0 failed to generate new component #23141

s-triar opened this issue May 16, 2022 · 6 comments · Fixed by #23149
Assignees
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Milestone

Comments

@s-triar
Copy link

s-triar commented May 16, 2022

🐞 Bug report

Command (mark with an x)

  • new
  • build
  • serve
  • test
  • e2e
  • generate
  • add
  • update
  • lint
  • extract-i18n
  • run
  • config
  • help
  • version
  • doc

Is this a regression?

Yes, the previous version in which this bug was not present was:

I don't know. the tutorial angular 14 especially for a standalone component on youtube shows that the angular-cli is working perfectly.

Description

After run npm i -g @angular/cli@next to trying angular 14 RC, the angular-cli is failed to generate component using ng g component <name-component>

🔬 Minimal Reproduction

I am using windows 10.

  1. Upgrade angular-cli to 14 rc using npm i -g @angular/cli@next
  2. Create new project ng new <name-project>
  3. Generate new component using ng g component <name-component>

below is the package.json I am currently using.

{
  "name": "berdikari",
  "version": "0.0.0",
  "scripts": {
    "ng": "ng",
    "start": "ng serve",
    "build": "ng build",
    "watch": "ng build --watch --configuration development",
    "test": "ng test",
    "dev:ssr": "ng run berdikari:serve-ssr",
    "serve:ssr": "node dist/berdikari/server/main.js",
    "build:ssr": "ng build && ng run berdikari:server",
    "prerender": "ng run berdikari:prerender"
  },
  "private": true,
  "dependencies": {
    "@angular/animations": "^14.0.0-rc.0",
    "@angular/cdk": "^14.0.0-rc.0",
    "@angular/common": "^14.0.0-rc.0",
    "@angular/compiler": "^14.0.0-rc.0",
    "@angular/core": "^14.0.0-rc.0",
    "@angular/forms": "^14.0.0-rc.0",
    "@angular/platform-browser": "^14.0.0-rc.0",
    "@angular/platform-browser-dynamic": "^14.0.0-rc.0",
    "@angular/platform-server": "^14.0.0-rc.0",
    "@angular/router": "^14.0.0-rc.0",
    "@angular/service-worker": "^14.0.0-rc.0",
    "@fortawesome/angular-fontawesome": "^0.10.2",
    "@nguniversal/express-engine": "^14.0.0-rc.0",
    "@zxing/browser": "^0.0.5",
    "@zxing/library": "^0.18.3",
    "@zxing/ngx-scanner": "3.1.3",
    "angular-oauth2-oidc": "^13.0.1",
    "angular-oauth2-oidc-jwks": "^13.0.1",
    "aspnet-prerendering": "^3.0.1",
    "express": "^4.15.2",
    "jwt-decode": "^3.1.2",
    "ng-thermal-print": "^1.0.3",
    "ngx-image-compress": "^11.0.3",
    "rxjs": "~7.5.0",
    "tslib": "^2.3.0",
    "uuid": "^8.3.2",
    "zone.js": "~0.11.4"
  },
  "devDependencies": {
    "@angular-devkit/build-angular": "^14.0.0-rc.0",
    "@angular/cli": "~14.0.0-rc.0",
    "@angular/compiler-cli": "^14.0.0-rc.0",
    "@angular/language-service": "^14.0.0-rc.0",
    "@nguniversal/builders": "^14.0.0-rc.0",
    "@tailwindcss/aspect-ratio": "^0.4.0",
    "@tailwindcss/forms": "^0.5.1",
    "@tailwindcss/line-clamp": "^0.4.0",
    "@tailwindcss/typography": "^0.5.2",
    "@types/express": "^4.17.0",
    "@types/jasmine": "~4.0.0",
    "@types/node": "^14.15.0",
    "@types/uuid": "^8.3.3",
    "@types/w3c-web-serial": "^1.0.2",
    "@types/w3c-web-usb": "^1.0.5",
    "@types/web-bluetooth": "0.0.12",
    "autoprefixer": "^10.4.7",
    "jasmine-core": "~4.1.0",
    "karma": "~6.3.0",
    "karma-chrome-launcher": "~3.1.0",
    "karma-coverage": "~2.2.0",
    "karma-jasmine": "~5.0.0",
    "karma-jasmine-html-reporter": "~1.7.0",
    "postcss": "^8.4.13",
    "tailwindcss": "^3.0.24",
    "tailwindcss-children": "^2.1.0",
    "typescript": "~4.6.2"
  }
}

🔥 Exception or Error


An unexpected error occurred: {}

image

🌍 Your Environment



     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / △ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/
    

Angular CLI: 14.0.0-rc.0
Node: 16.13.1
Package Manager: npm 8.1.2
OS: win32 x64

Angular: 14.0.0-rc.0
... animations, cdk, cli, common, compiler, compiler-cli, core
... forms, language-service, platform-browser
... platform-browser-dynamic, platform-server, router
... service-worker

Package                         Version
---------------------------------------------------------
@angular-devkit/architect       0.1400.0-rc.0
@angular-devkit/build-angular   14.0.0-rc.0
@angular-devkit/core            14.0.0-rc.0
@angular-devkit/schematics      14.0.0-rc.0
@nguniversal/builders           14.0.0-rc.0
@nguniversal/express-engine     14.0.0-rc.0
@schematics/angular             14.0.0-rc.0
rxjs                            7.5.5
typescript                      4.6.4

@alan-agius4
Copy link
Collaborator

I'm sorry, but we can't reproduce the problem following the instructions you provided.

Can you setup a minimal repro please?

You can read here why this is needed. A good way to make a minimal repro is to create a new app via ng new repro-app and adding the minimum possible code to show the problem. Then you can push this repository to github and link it here.

This might be related to your directory structure so its really important to get an accurate repro to diagnose this.

@alan-agius4 alan-agius4 added the needs: repro steps We cannot reproduce the issue with the information given label May 16, 2022
@dzhavat
Copy link

dzhavat commented May 16, 2022

I just experienced the same error. My repo is here https://github.com/dzhavat/angular-standalone-components

Running ng version gives me this

image

@alan-agius4 alan-agius4 self-assigned this May 16, 2022
@alan-agius4 alan-agius4 added freq1: low Only reported by a handful of users who observe it rarely severity5: regression area: @angular/cli and removed needs: repro steps We cannot reproduce the issue with the information given labels May 16, 2022
@ngbot ngbot bot added this to the needsTriage milestone May 16, 2022
@ngbot ngbot bot modified the milestones: needsTriage, Backlog May 16, 2022
@s-triar
Copy link
Author

s-triar commented May 17, 2022

@s-triar
Copy link
Author

s-triar commented May 17, 2022

for some reason. ng g directive <name-dir> also has the same error

image

alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 17, 2022
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 17, 2022
alan-agius4 added a commit to alan-agius4/angular-cli that referenced this issue May 17, 2022
@s-triar
Copy link
Author

s-triar commented May 17, 2022

When I change the file according to f2764c6

it happened because there is more than 1 module.

@s-triar s-triar closed this as completed May 17, 2022
@alan-agius4 alan-agius4 reopened this May 17, 2022
dgp1130 pushed a commit that referenced this issue May 17, 2022
dgp1130 pushed a commit that referenced this issue May 17, 2022
Previously, the errors were JSON stringified (https://github.com/angular/angular-cli/blob/main/packages/angular/cli/lib/cli/index.ts#L80) which caused them not to be displayed correctly.

Closes #23141

(cherry picked from commit f00da00)
@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 Jun 17, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
area: @angular/cli freq1: low Only reported by a handful of users who observe it rarely severity5: regression type: bug/fix
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants