When we install @angular/cli globally, we pin the version of ng binary to a specific version which results in us using out-of-date ng binary most of the times(Angular CLI team publishes new version on a weekly basis).
And if we are working in a team, we could be out of sync with the rest of developers since each dev might have different version of @angular/cli installed.
- NPM
npm list --global --depth 0 - Yarn
yarn global list
- NPM
npm uninstall --global @angular/cli - Yarn
yarn global remove @angular/cli
- New Angular Workspace
npx @angular/cli new web-apps --create-application false - New application
npx @angular/cli new admin-consolenpxtool comes bundled with Node.js,npxdownloads latest verison of@angular/cliat that time and executes it on your machine.
When @angular/cli generates a new project, it will also install @angular/cli locally in the newly created project.
If you are using yarn package manager, you can simply run yarn ng generate component components/header inside the directory which has package.json and node_modules.
If using NPM, one could directly invoke ng binary: node_modules/.bin/ng generate component components/header or npm run ng generate component components/header