Couldn't Install angular cli with npm - node.js

I'm using 8.9.2 version of node js and when I tried to install angular cli
with this command : npm -g install #angular/cli
It is displaying some npm errors
This is what I got on my cmd prompt screen :
npm ERR! Unexpected end of JSON input while parsing near '...-2.3.0.tgz"},"engines'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\haris_000\AppData\Roaming\npm-cache\_logs\2017-12-05T12_19_58_814Z-debug.log

I guess the command to install Angular is:
npm install -g #angular/cli

Related

Installing dependencies with npm-peer-dependencies

I am trying to install the required node_modules for a small project running Angular 11 using npm install
My goal is get the project to work locally after downloading it from GitHub. I have already installed the latest version of the Angular CLI.
After running the install command I tried npm start.
I was expecting that after running the install and start command to be able to run the project locally.
However the actual result I get after running the install command is the following list of errors:
> ng serve
An unhandled exception occurred: Cannot find module '#angular/compiler'
Require stack:
\node_modules\#angular\compiler-cli\index.js
\node_modules\#ngtools\webpack\src\angular_compiler_plugin.js
\node_modules\#ngtools\webpack\src\index.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\typescript.js
\node_modules\#angular-devkit\build-angular\src\webpack\configs\index.js
\node_modules\#angular-devkit\build-angular\src\browser\index.js
\node_modules\#angular-devkit\build-angular\src\dev-server\index.js
\node_modules\#angular-devkit\architect\node\node-modules-architect-host.js
\node_modules\#angular-devkit\architect\node\index.js
\node_modules\#angular\cli\models\architect-command.js
\node_modules\#angular\cli\commands\serve-impl.js
\node_modules\#angular-devkit\schematics\tools\export-ref.js
\node_modules\#angular-devkit\schematics\tools\index.js
\node_modules\#angular\cli\utilities\json-schema.js
\node_modules\#angular\cli\models\command-runner.js
\node_modules\#angular\cli\lib\cli\index.js
\node_modules\#angular\cli\lib\init.js
\node_modules\#angular\cli\bin\ng
See "angular-errors.log" for further details.
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file C:\WINDOWS\system32\cmd.exe
npm ERR! errno ENOENT
npm ERR! `ng serve`
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the #0.0.16 start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
The problem is that this Angular project also has peer dependencies. I installed npm-install-peers package but it seems that simply running npm install afterwards will not install the required peer dependencies.
What should I do next to get this Angular project installed locally ?
The issue you are facing is likely because angular cli or npm-peer-dependencies are not installed globally on your machine.
The steps that you should take are to make sure of them are globally installed.
To install packages globally you need run npm install -g <package_name>
npm docs link
In your case for angular cli you should run
npm i -g #angular/cli#11.2.15 and npm install -g npm-peer-dependencies.
Then run npm start.

"Unexpected end of JSON input while parsing near" Error : npm install -g#angular/cli

Always give an error message when i try to install angular using this npm install -g#angular/cli
PS C:\Users\admin\Desktop\sonal> npm install -g #angular/cli npm ERR!
Unexpected end of JSON input while parsing near '...EGIN PGP
SIGNATURE---'
npm ERR! A complete log of this run can be found in: npm ERR!
C:\Users\admin\AppData\Roaming\npm-cache_logs\2020-07-12T09_04_02_173Z-debug.log.
For this we use node version 12.18.0 and npm version 6.14.6.Please help me for solving this error.
step 0: run this command
npm uninstall -g #angular/cli
npm cache clean
step 1: delete this folder: C:\Users%YOUR-USERNAME%\AppData\Roaming\npm
step 2: uninstall Nodejs from Windows
step 3: restart your PC
step 4: install a fresh copy of Nodejs from here:Link
step 5: install the CLI globally
npm install -g #angular/cli#latest

Installing the Express Application Generator using npm

unable to install these package using npm: npm install eslint --save-dev , npm install -g express-generator
Both time give same error :**
npm ERR! Unexpected end of JSON input while parsing near '...0.2.13":{"name":"mini'
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-06-04T15_20_40_810Z-debug.log
but while installing another package npm install express it successfully installed
try to clean npm cache and then reinstall the packages
npm cache clean --force
npm install eslint --save-dev
npm install -g express-generator

after running the command npm install -g #angular\cli i receive an npm ERR! code ENOLOCAL

I initially used a computer running windows 10 and also on another computer that runs windows 8.1 but, I still receive the same message on both computers. The error log is:
npm ERR! code ENOLOCAL
npm ERR! Could not install from "#angular\cli" as it does not contain a package.json file.
The node and npm versions are 8.2.1 and 5.3.0 respectively.
When I run the command on git bash I receive a different error message. The error log is:
npm ERR! code EINVALIDTAGNAME
npm ERR! Invalid tag name "#angularcli": Tags may not have any characters that encodeURIComponent encodes.
Your command is wrong:
It's #angular/cli with a forward slash not #angular\cli
npm install -g #angular/cli
In order to install angular-cli on windows use
npm install -g #angular/cli in place of npm install –g #angular-cli

Error installing ionic cordova

$ npm install -g cordova ionic
npm ERR! Unexpected end of input at 1:172390
npm ERR! version":"3.20.2","dependencies":
{"basic-auth":"1.0.0","connect":"2.2
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Inspiron 15\AppData\Roaming\npm-cache\_logs\2017-08-
01T08_02_19_789Z-debug.log
I'm keep getting this error while trying to install cordova ionic. I've already installed node js latest version to my computer.
Try :
sudo apt-get install nodejs nodejs-legacy npm
And then :
sudo npm install -g cordova

Resources