angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.76k stars 11.97k forks source link

ng version bug #18667

Closed xgqfrms closed 4 years ago

xgqfrms commented 4 years ago

🐞 Bug report

Command (mark with an x)

Is this a regression?

Yes, the previous version in which this bug was not present was: .... not sure ### Description A clear and concise description of the problem... 1. website error https://angular.io/cli/version REQUEST FOR DOCUMENT FAILED. We are unable to retrieve the "cli/version" page at this time. Please check your connection and try again later. 2. command error ```sh $ ng --version $ ng -v ``` ```log An unhandled exception occurred: ENOENT: no such file or directory, scandir '/Users/xgqfrms-mbp/Documents/GitHub/Angular-8.x-in-Action/node_modules' See "/private/var/folders/qm/csrtpvpn62x82v4zykvsrnw80000gn/T/ng-oL5J8g/angular-errors.log" for further details. ``` ![image](https://user-images.githubusercontent.com/7291672/91798406-650ecc80-ec57-11ea-935a-5f0a1486ba7a.png) ![image](https://user-images.githubusercontent.com/7291672/91798469-8a033f80-ec57-11ea-901a-20a314b2780e.png) ## πŸ”¬ Minimal Reproduction
  1. install angular cli
# βœ…
$ yarn global add @angular/cli
  1. executing above commands
    
    $ ng --version

$ ng -v



## πŸ”₯ Exception or Error
<pre><code>
<!-- If the issue is accompanied by an exception or an error, please share it below: -->
<!-- ✍️-->
An unhandled exception occurred: ENOENT: no such file or directory, scandir '/Users/xgqfrms-mbp/Documents/GitHub/Angular-8.x-in-Action/node_modules'
See "/private/var/folders/qm/csrtpvpn62x82v4zykvsrnw80000gn/T/ng-oL5J8g/angular-errors.log" for further details.

</code></pre>

## 🌍 Your Environment
<pre><code>
<!-- run `ng version` and paste output below -->
<!-- ✍️-->
➜  ~ uname -a
Darwin xgqfrms-mbp.local 19.5.0 Darwin Kernel Version 19.5.0: Tue May 26 20:41:44 PDT 2020; root:xnu-6153.121.2~2/RELEASE_X86_64 x86_64
➜  ~ 

</code></pre>

**Anything else relevant?**
<!-- ✍️Is this a browser specific issue? If so, please specify the browser and version. -->

<!-- ✍️Do any of these matter: operating system, IDE, package manager, HTTP server, ...? If so, please mention it below. -->
xgqfrms commented 4 years ago

error log

[error] Error: ENOENT: no such file or directory, scandir '/Users/xgqfrms-mbp/Documents/GitHub/Angular-8.x-in-Action/node_modules'
    at Object.readdirSync (fs.js:948:3)
    at VersionCommand.run (/Users/xgqfrms-mbp/.config/yarn/global/node_modules/@angular/cli/commands/version-impl.js:52:41)
    at VersionCommand.validateAndRun (/Users/xgqfrms-mbp/.config/yarn/global/node_modules/@angular/cli/models/command.js:135:39)
    at async Object.runCommand (/Users/xgqfrms-mbp/.config/yarn/global/node_modules/@angular/cli/models/command-runner.js:198:24)
    at async default_1 (/Users/xgqfrms-mbp/.config/yarn/global/node_modules/@angular/cli/lib/cli/index.js:62:31)
xgqfrms commented 4 years ago

why must create project first, then can get the version info

--version is so common usage, why change it to just version

why not using -v, but v, very confused me ❓

$ ng --help
$ ng -h
# $ ng help

# must create project first, then can get the version info
$ ng new angular-fullstack-app

# $ ng --version
$ ng version
$ ng v
➜  angular-fullstack-app git:(master) βœ— ng v 

     _                      _                 ____ _     ___
    / \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|
   / β–³ \ | '_ \ / _` | | | | |/ _` | '__|   | |   | |    | |
  / ___ \| | | | (_| | |_| | | (_| | |      | |___| |___ | |
 /_/   \_\_| |_|\__, |\__,_|_|\__,_|_|       \____|_____|___|
                |___/

Angular CLI: 10.0.8
Node: 12.18.0
OS: darwin x64

Angular: 10.0.14
... animations, common, compiler, compiler-cli, core, forms
... platform-browser, platform-browser-dynamic, router
Ivy Workspace: Yes

Package                           Version
-----------------------------------------------------------
@angular-devkit/architect         0.1000.8
@angular-devkit/build-angular     0.1000.8
@angular-devkit/build-optimizer   0.1000.8
@angular-devkit/build-webpack     0.1000.8
@angular-devkit/core              10.0.8
@angular-devkit/schematics        10.0.8
@angular/cli                      10.0.8
@ngtools/webpack                  10.0.8
@schematics/angular               10.0.8
@schematics/update                0.1000.8
rxjs                              6.5.5
typescript                        3.9.7
webpack                           4.43.0

➜  angular-fullstack-app git:(master) βœ— 
angular-automatic-lock-bot[bot] commented 4 years ago

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.