Using the command prompt, I am trying to install angular CLI and it fails. I have npm version 5.5.1 and node version v8.9.1. I am trying to install angular cli using the command
npm install -g #angular/cli#latest
and it fails with the error:
npm ERR! code E404
npm ERR! 404 Not Found: #angular/cli#latest
npm ERR! A complete log of this run can be found in:
I look at the log file and I see its trying to fetch the package from a location that doesn't exist. Not sure from where it gets pulled. How do I fix this location path and install angular cli. Same happens when I try to install typescript or any other npm package. all of them try to install from the location mentioned below and it fails with 404
8 http fetch GET 404
http://nuget.feed.xyz.corp:8729/npm/FeedNPM/#angular%2fcli 109ms
9 silly fetchPackageMetaData error for #angular/cli#latest 404 Not Found:
#angular/cli#latest
10 verbose stack Error: 404 Not Found: #angular/cli#latest
npm config set registry http://registry.npmjs.org
NPM registry documentation
Try first this commands (in windows run as administrator)
npm config set registry http://registry.npmjs.org
npm install -g #angular/cli
if still not working let's update NPM and nodejs by running this commands
npm -g install npm
npm cache clean -f
npm install -g n
then try to run
npm install -g #angular/cli
This should solve this problem
in my case it was .npmrc file in my project dir, which kept overwriting my global registry url. As soon as I deleted it, I could finally use npm install
Add a .npmrc file in the root of the project. .npmrc will look like below -
#xy:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
#xy-app:registry=https://xyz.jfrog.io/xyz/api/npm/npm-local/
And Delete all the field eg - email , auth etc.
Find out what is the registry url of your application and put it into the registry.
Then run command - npm install
And it will work.
It was giving the same error for me when I use office network/vpn as they have 'umbrella' DNS security shield. To solve this issue, connect to personal network and type the below commands:
npm config set registry http://registry.npmjs.org
npm install -g #angular/cli
Alternative, another option to avoid 404 npm error
check if your terminal is in the root directory, if not your npm scripts will not execute
because it will not be able to see the package.json
I had same problem with a private package.
Need to:
npm adduser
npm login
I spent hours on this.
I had to follow the below steps to get it to work (mac).
Delete my LOCAL (not project) .npmrc by running:
rm /Users/<NAME>/.npmrc
Then set the registry:
npm config set registry https://registry.npmjs.org/
Then follow the steps for logging in to npm:
npm login
Check what's in your config list by running:
npm config list
It should look like this:
//registry.npmjs.org/:_authToken = (protected)
registry = "https://registry.npmjs.org/"
Hope it works for you too.
change your access level to public. type this in the terminal
npm --access=public
install your angular.
sudo npm install #ngular/cli
In my case, that's a typo error:
change trct-js-sdk to trtc-js-sdk saved my life.
My solution was as follows because I had a dependency on a private package. If you see the dependency in package.json defined in the format #scope/package, then #scope tells you that it's a scoped package that might be private.
Get the private package owner to grant you access to the package
Upgrade npm
Upgrade node
Add registry using HTTPS (not HTTP), e.g. npm config set registry https://registry.npmjs.org
Do "npm login"
Now run the build
Uninstall NPM & nodejs and install the right way NPM (Ubuntu)
sudo with npm is not recommended
To Uninstall
sudo apt-get remove nodejs
sudo apt-get remove npm
or
sudo apt-get purge nodejs
Followed by proper installation
curl -o-
https://raw.githubusercontent.com/nvm-sh/nvm/v0.34.0/install.sh | bash
To confirm open a new terminal run:
$ command -v nvm
Latest LTS release of NodeJS:
$ nvm install --lts
Set default environment
$ nvm alias default lts/*
Worked for me
I got
error 404 'dotnev#*' is not in this registry.
Deleted .npmrc file in 2 folders back over my project root
and then in the project root folder typed:
npm i dotenv
copied from:
https://www.npmjs.com/package/dotenv
Just run sudo npm config set registry http://registry.npmjs.org and then update your npm.
It is an network error , check your network connection and try to install it again.
the only command line "npm -g install npm" solved the issue for me!
the following link can be helpful to dig deep for a better understanding.
Thanks a lot.
Related
When creating a new Angular 5 project:
node version: 8.9.2
npm version: 5.5.1
My Command is:
npm install -g #angular/cli
The Error is:
npm ERR! **Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'**
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aashitec\AppData\Roaming\npm-cache\_logs\2017-12-06T13_10_10_729Z-debug.log
The error log is here
This solved it for me:
Open Windows Powershell as admin
npm cache clean --force
npm install -g #angular/cli
https://devblogs.microsoft.com/premier-developer/getting-started-with-node-js-angular-and-visual-studio-code/
Solution:
npm cache clean --force
then try again to create your app (here when creating a react app) or install what you were about to install.
create-react-app myproject
(creating react app)[same npm problem that can occur in different operation]
npm install -g #angular/cli#latest
(installing angular cli (or installing anything else))
It will work.
explanation:
That's a problem related to npm, it's about the cache that get corrupt. Even though in newer versions of npm they implemented self healing, which normally guarantee no corruption, but it seem it's not that efficient.
Forcing clean cache resolve the problem.
The error happen when parsing one of the cache files, which have a json format. The cache is found at ~/.npm/_cacache (in linux) and %AppData%/npm-cache (windows). For my current npm version and when i checked, there was three directories.
if you check the first or the second, the structure is as follow
And each cache file have a json format (and that what get parsed)
Here a good link from the doc: https://docs.npmjs.com/cli/cache
[Update] Also if it happen that this didn't solve it, you may check this answer here https://stackoverflow.com/a/50191315/7668448 it show how you can change the npm registry, that can be helpful. Check and see.
If
npm cache clean --force
doesn't work.
try
npm cache clean --force
npm update
Npm uses Cache for downloading new packages for you.
You need to clear your npm cache.
use following command to clean :
npm cache clean --force
then normally use your npm install command
e.g.
npm install -g #angular/cli
I solve that with
npm cache clean --force
then update npm
npm i npm#latest -g
then normally use your npm install command
npm install
delete npm and npm-cache folders in C:\Users\admin\AppData\Roaming\ (windows)
then execute cmd
npm cache clear --force
npm cache verify
update npm to latest version
npm i -g npm
then create your project
1)Angular
npm i -g #angular/cli#latest
ng new HelloWorld
2)React
npm i -g create-react-app
create-react-app react-app
None of the 30 answers here worked for me. I needed to:
delete node_modules and package-lock.json
npm cache clean --force
npm install -g #angular/cli
npm i --package-lock-only
npm ci
Phew!
this solved it npm cache clean --force
Simple solutions:
npm cache clean --force
npm install
This command alone solved my problem:
npm cache clean --force
Also you should make sure you are using the correct version of node.
Using nvm to manage the node version:
nvm list; # check your local versions;
nvm install 10.10.0; # install a new remote version;
nvm alias default 10.10.0; # set the 10.10.0 as the default node version, but you have to restart the terminal to make it take effect;
I use Windows and removed all the files that were listed below and my problem was solved
C:\Users{{your-username}}\AppData\Roaming\npm-cache
npm cache clean --force worked for me
Error Resolved :
$ npm install -g gulp
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! Unexpected end of JSON input while parsing near '.../RGs88STtAtiMP3tCiNdU'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-11-20T07_38_56_733Z-debug.log
Solution
npm cache clean --force
For Windows : go to C:\Users\username\AppData\Roaming\npm-cache
Delete all files and run
npm install && npm start
I solved that by first cleaning the cache using
npm cache clean --force
Then
npm install -g #angular/cli
My case - Windows 7 (had nothing better at the needed moment).
Helped me the following:
Deleting everything from C:\Users\username\AppData\Roaming\npm-cache
AND
Deleting package-lock.json
I resolved my problem with this one liner
npm cache clean --force
Note: since its a clean install, I had no concerns emptying npm cache.
ERROR: npm ERR! Unexpected end of JSON input while parsing near '...ore-js":"3.0.0-beta.1
This occurs when installing the expo CLI globally, This works for me!
npm cache clean --force
I got error (file already exists --force to overwrite) after running the following code:
npm cache clean --force
npm install -g #angular/cli
I solved it using :
npm i -g --force npm
Make sure to run the first commands to flush the cache of npm.
It's error from your npm....
So unistall node and install it again.
It works....
PS: After installing node again, install angular cli globally.
npm install -g #angular/cli#latest
I solve that with
First delete package-lock.json
npm cache clean --force
then update npm
npm i npm#latest -g
then use npm install command
npm install
If you looking for npm install and getting same kind of error
Delete package-lock.json and npm cache clean --force and try
In my case I changed the network to a much stronger one and npm install worked perfectly:
npm cache clean --force
If npm cache clean --force doesn't resolve the issue, try deleting the ~/.npm directory (*nix/macOS). This is the directory where node stores its cache, locks, logs, global packages (unless you're using nvm), and modules installed via npx.
First, backup your current ~/.npm directory:
mv ~/.npm ~/.npm-backup
Now try running your npm command again. This will create a new ~/.npm directory. If the issue is resolved, you can safely remove you backup. Before doing so, you may want to review the global packages installed in your ~/.npm-backup directory so you can reinstall them using npm i -g [package].
rm -rf ~/.npm-backup
If the issue is not resolved, you can restore your backup:
rm -rf ~/.npm
mv ~/.npm-backup ~/.npm
Careful with those rm commands, folks!
Instead of clearing the cache you can set a temporary folder:
npm install --cache /tmp/empty-cache
or
npm install --global --cache /tmp/empty-cache
As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use npm cache verify instead. On the other hand, if you're debugging an issue with the installer, you can use npm install --cache /tmp/empty-cache to use a temporary cache instead of nuking the actual one.
For me I had to clone my branch again and do npm install
You can use yarn package manager instead of npm.
It solved this problem for me
I've faced this issue and I tried all the answers on Stackoverflow but not worked for me, finally I found solution for this issue:
First of all you have to uninstall nodejs and remove all the files related him
Go to "Register Editor" and search for all "nodejs", "node.js" and delete them
Restart your computer
And reinstall nodejs then install angular.
It's worked for me
These commands worked for me
sudo npm cache clean --force
sudo npm cache verify
sudo npm i npm#latest -g
Try setting
npm config set strict-ssl false
and then try running,
npm install -g #angular/cli
This happens something due to cache or outdated version of Node Package Manager
i just updated my NPM it works fine
here is command to update Npm to latest version
npm i npm#latest -g
after updating NPM run your desired command
When creating a new Angular 5 project:
node version: 8.9.2
npm version: 5.5.1
My Command is:
npm install -g #angular/cli
The Error is:
npm ERR! **Unexpected end of JSON input while parsing near '...nt-webpack-plugin":"0'**
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aashitec\AppData\Roaming\npm-cache\_logs\2017-12-06T13_10_10_729Z-debug.log
The error log is here
This solved it for me:
Open Windows Powershell as admin
npm cache clean --force
npm install -g #angular/cli
https://devblogs.microsoft.com/premier-developer/getting-started-with-node-js-angular-and-visual-studio-code/
Solution:
npm cache clean --force
then try again to create your app (here when creating a react app) or install what you were about to install.
create-react-app myproject
(creating react app)[same npm problem that can occur in different operation]
npm install -g #angular/cli#latest
(installing angular cli (or installing anything else))
It will work.
explanation:
That's a problem related to npm, it's about the cache that get corrupt. Even though in newer versions of npm they implemented self healing, which normally guarantee no corruption, but it seem it's not that efficient.
Forcing clean cache resolve the problem.
The error happen when parsing one of the cache files, which have a json format. The cache is found at ~/.npm/_cacache (in linux) and %AppData%/npm-cache (windows). For my current npm version and when i checked, there was three directories.
if you check the first or the second, the structure is as follow
And each cache file have a json format (and that what get parsed)
Here a good link from the doc: https://docs.npmjs.com/cli/cache
[Update] Also if it happen that this didn't solve it, you may check this answer here https://stackoverflow.com/a/50191315/7668448 it show how you can change the npm registry, that can be helpful. Check and see.
If
npm cache clean --force
doesn't work.
try
npm cache clean --force
npm update
Npm uses Cache for downloading new packages for you.
You need to clear your npm cache.
use following command to clean :
npm cache clean --force
then normally use your npm install command
e.g.
npm install -g #angular/cli
I solve that with
npm cache clean --force
then update npm
npm i npm#latest -g
then normally use your npm install command
npm install
delete npm and npm-cache folders in C:\Users\admin\AppData\Roaming\ (windows)
then execute cmd
npm cache clear --force
npm cache verify
update npm to latest version
npm i -g npm
then create your project
1)Angular
npm i -g #angular/cli#latest
ng new HelloWorld
2)React
npm i -g create-react-app
create-react-app react-app
None of the 30 answers here worked for me. I needed to:
delete node_modules and package-lock.json
npm cache clean --force
npm install -g #angular/cli
npm i --package-lock-only
npm ci
Phew!
this solved it npm cache clean --force
Simple solutions:
npm cache clean --force
npm install
This command alone solved my problem:
npm cache clean --force
Also you should make sure you are using the correct version of node.
Using nvm to manage the node version:
nvm list; # check your local versions;
nvm install 10.10.0; # install a new remote version;
nvm alias default 10.10.0; # set the 10.10.0 as the default node version, but you have to restart the terminal to make it take effect;
I use Windows and removed all the files that were listed below and my problem was solved
C:\Users{{your-username}}\AppData\Roaming\npm-cache
npm cache clean --force worked for me
Error Resolved :
$ npm install -g gulp
npm WARN deprecated gulp-util#3.0.8: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
npm ERR! Unexpected end of JSON input while parsing near '.../RGs88STtAtiMP3tCiNdU'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache_logs\2018-11-20T07_38_56_733Z-debug.log
Solution
npm cache clean --force
For Windows : go to C:\Users\username\AppData\Roaming\npm-cache
Delete all files and run
npm install && npm start
I solved that by first cleaning the cache using
npm cache clean --force
Then
npm install -g #angular/cli
My case - Windows 7 (had nothing better at the needed moment).
Helped me the following:
Deleting everything from C:\Users\username\AppData\Roaming\npm-cache
AND
Deleting package-lock.json
I resolved my problem with this one liner
npm cache clean --force
Note: since its a clean install, I had no concerns emptying npm cache.
ERROR: npm ERR! Unexpected end of JSON input while parsing near '...ore-js":"3.0.0-beta.1
This occurs when installing the expo CLI globally, This works for me!
npm cache clean --force
I got error (file already exists --force to overwrite) after running the following code:
npm cache clean --force
npm install -g #angular/cli
I solved it using :
npm i -g --force npm
Make sure to run the first commands to flush the cache of npm.
It's error from your npm....
So unistall node and install it again.
It works....
PS: After installing node again, install angular cli globally.
npm install -g #angular/cli#latest
I solve that with
First delete package-lock.json
npm cache clean --force
then update npm
npm i npm#latest -g
then use npm install command
npm install
If you looking for npm install and getting same kind of error
Delete package-lock.json and npm cache clean --force and try
In my case I changed the network to a much stronger one and npm install worked perfectly:
npm cache clean --force
If npm cache clean --force doesn't resolve the issue, try deleting the ~/.npm directory (*nix/macOS). This is the directory where node stores its cache, locks, logs, global packages (unless you're using nvm), and modules installed via npx.
First, backup your current ~/.npm directory:
mv ~/.npm ~/.npm-backup
Now try running your npm command again. This will create a new ~/.npm directory. If the issue is resolved, you can safely remove you backup. Before doing so, you may want to review the global packages installed in your ~/.npm-backup directory so you can reinstall them using npm i -g [package].
rm -rf ~/.npm-backup
If the issue is not resolved, you can restore your backup:
rm -rf ~/.npm
mv ~/.npm-backup ~/.npm
Careful with those rm commands, folks!
Instead of clearing the cache you can set a temporary folder:
npm install --cache /tmp/empty-cache
or
npm install --global --cache /tmp/empty-cache
As of npm#5, the npm cache self-heals from corruption issues and data extracted from the cache is guaranteed to be valid. If you want to make sure everything is consistent, use npm cache verify instead. On the other hand, if you're debugging an issue with the installer, you can use npm install --cache /tmp/empty-cache to use a temporary cache instead of nuking the actual one.
For me I had to clone my branch again and do npm install
You can use yarn package manager instead of npm.
It solved this problem for me
I've faced this issue and I tried all the answers on Stackoverflow but not worked for me, finally I found solution for this issue:
First of all you have to uninstall nodejs and remove all the files related him
Go to "Register Editor" and search for all "nodejs", "node.js" and delete them
Restart your computer
And reinstall nodejs then install angular.
It's worked for me
These commands worked for me
sudo npm cache clean --force
sudo npm cache verify
sudo npm i npm#latest -g
Try setting
npm config set strict-ssl false
and then try running,
npm install -g #angular/cli
This happens something due to cache or outdated version of Node Package Manager
i just updated my NPM it works fine
here is command to update Npm to latest version
npm i npm#latest -g
after updating NPM run your desired command
So I'm attempting to run npm install into my WP theme folder so I can convert .scss to css.
When I try to install this is all I see:
Web-Stations-Mac-Pro:ideabased matmorse$ npm install
npm WARN matmorse#1.0.0 No description
npm WARN matmorse#1.0.0 No repository field.
removed 7 packages in 1.661s
I've tried uninstalling NPM and NODE and re installing it with Brew. I've also tried correcting my permissions. The node_modules folder never installs.
NPM -v : 5.3.0
No - v: 8.3.0
Nothing seems to work.
You don't have package.json in the folder so you can't use the npm install command, since npm install looks for the package.json (that's why you are getting no description found error) .
You can use npm install node-sass to install the node-sass module.
You can refer the documentation for further clarification on npm install.
Use the following commands:
npm config get prefix
sudo chown -R $(whoami) $(npm config get prefix)/{lib/node_modules,bin,share}
I have installed create-react-app exactly as instructed on the facebook instruction page (https://facebook.github.io/react/blog/2016/07/22/create-apps-with-no-configuration.html):
First, install the global package:
npm install -g create-react-app
I did this. It appeared to work fine - the file was installed to
users/*name*/.node_modules_global/lib/node_modules/create-react-app
I'm not really sure why global install takes it to this path, but there you have it.
Next instruction:
Now you can use it to create a new app:
create-react-app hello-world
Couldn't be simpler, right? But Terminal spits out this at me:
-bash: create-react-app: command not found
It's probably something very simple I'm missing but I don't really know where to look. If anyone can help I'd really appreciate it!
Note: I'm using Node v6.3.1, and npm v3.10.3
You are able to apply the following solution:
$ npm config set prefix /usr/local
$ sudo npm install -g create-react-app
$ create-react-app my-app
The environment variables are not set properly.
When you run the create-react-app it shows you a path along with the error. Copy that path and add it in the environment variable.
Alternatively you can use the command:
npx create-react-app <app_name>.
This will do the work for you.
Your Node setup looks incorrect. It's not an issue with Create React App—it seems like you can't run any global Node commands.
It looks like ~/.node_modules_global/bin is not in your PATH environment variable so it can't execute global commands. That's just how Bash works—it can't guess where the command lies, you need to tell it. I would assume Node installation should do this by default but it depends on how you installed Node.
So make sure that directory is in your PATH and try again. If you use Bash, add this to your .profile and then restart the Terminal:
export PATH=$HOME/.node_modules_global/bin:$PATH
Try this. It worked or me. I found this in the React documentation. "Npx" is not a typo. It's a package runner tool that comes with npm 5.2+.
npx create-react-app my-app
In 2020 Dec 17
Install Nodejs & npm
sudo apt update
sudo apt install nodejs
sudo apt install npm
if you install maybe show you this like errors for Reactjs setup.this helpful for you
npm install -g create-react-app
npm ERR! code EACCES
npm ERR! syscall mkdir
npm ERR! path /usr/local/lib/node_modules/create-react-app
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/create-react-app'
npm ERR! [Error: EACCES: permission denied, mkdir '/usr/local/lib/node_modules/create-react-app'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'mkdir',
npm ERR! path: '/usr/local/lib/node_modules/create-react-app'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/user/.npm/_logs/2020-12-17T14_16_02_442Z-debug.log
then When you type after this
create-react-app test-react-app
Show you in terminal
zsh: command not found: create-react-app
you fix this error by using this command
sudo npm install -g create-react-app
create-react-app test-react-app
I hope work fine for you also.
Use npx instead of npm.
Check this out-> https://reactjs.org/docs/create-a-new-react-app.html#create-react-app
Answers given above are right but I want to share some things that I also faced and these are basics.
To setup react project
If you want to create a node environment
$ sudo apt-get update
$ sudo apt-get install nodejs
(Sometimes we can also run without sudo; but sudo means install in system level.)
$ sudo apt-get install nodeenv
$ nodeenv env
$ source /bin/activate
If you want to create new react app then
$ npm install create-react-app
If an error occurs create-react-app: command not found then install with -g, it happens because node is installed globally and it is not getting the node in local
$ npm install -g create-react-app
$ create-react-app app_name
$ cd app_name
app_name$ npm start
I hope you already installed Node package manager(npm).
now run npm install -g create-react-app, if everything fine then you can use create-ract-app command.
if you are getting any permission error just sudo npm install -g create-react-app.
I hope it will work.
Happy Hacking.
if you face following this problem:
create-react-app: command not found
solution:
sudo npx create-react-app react_spa
cd react_spa
sudo npm start
I hope its work.
If above answers are not working, then try this
update the npm version (npm install npm#latest -g)
clear the cache (npm cache clean --force)
create the react project (npx create-react-app myapp)
(while running the 3rd command, make sure that create-react-app is already installed in the pc)
This is how I get it fixed.
Step # 1:- Make sure, Node js and React js is installed globally. You can check Nodejs by
node --version . If not installed, install and run
export PATH=$HOME/.node_modules_global/bin:$PATH
Step # 2:- Clean your npm cache by following the command
npm cache clean --force
run
sudo npx create-react-app your-app-name
And that's it. you're done.
Please note, This solution worked for me for MAC OS
I tried all methods listed above and in other sites. They weren't working for me. But for some reason I decided to add the create-react-app directory into my system variables as a last ditch method and to my surprise this actually worked.
I faced a similar challenge but on running the command
npm i tar
I was able to resolve the issue.
I had install Node.js 4.2.2
i am trying to install socket.io package using npm install socket.io
but the npm installer just keep running with no error output in console after 30min..
Try to install some another package, mongoose for example. If it also fails try to reinstall npm by
npm install -g npm
Try the following:
npm install -g npm
npm cache clean
npm install socket.io
Also check if you permission to create node_modules folder in the directory you run npm.
You can downgrade your nodejs to v.4.2.1 for example, don't forget to clean npm cache after that, and then run npm install command.
First try to remove these packages and then install. Like
npm remove socket.io
Then
npm install socket.io
may be the incomplete installed files are blocking it to install properly
You need to update your npm anyway.
Try from link install:
curl -L https://www.npmjs.com/install.sh | sh
Or you can compile it with make if you clone sources from github