Cannot install generator-angular2 - node.js

When install generator-angular2, error shows:
npm WARN ENOENT ENOENT: no such file or directory, open
'/usr/local/lib/node_modules/generator-angular2/package.json'
npm WARN ENOENT ENOENT: no such file or directory, open
'/usr/local/lib/node_modules/generator-angular2/node_modules/yeoman-assert/package.json'
npm ERR! code 1
Then run yo angular2:
You don't seem to have a generator with the name angular2 installed.

Same problem faced by me while isntalling Grunt.js today ,you will need to add -g flag to your command which will install it globally.
npm install -g <package_name>
In your case it would be
npm install -g generator-angular2

I had this problem with run the command without "sudo".
example:
npm install -g generator-angular2
show error.
If I typed
sudo npm install -g generator-angular2
work fine.
In my case the problem is the initial instalation of npm, I installed with sudo.
When I need install something of npm I need sudo.

Related

Why am I getting an error when trying to install and run npm?

I am trying to install and run npm in a linux environment. I have executed the below code to try and achieve this
nvm install v11.0.0
nvm use v11.0.0
npm install
npm start
When I execute npm install in the command line I keep getting the following error message. Any advice to help this run is much appreciated.
npm WARN saveError ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN enoent ENOENT: no such file or directory, open '/home/andrewoca/PycharmProjects/pythonProject/package.json'
npm WARN pythonProject No description
npm WARN pythonProject No repository field.
npm WARN pythonProject No README data
npm WARN pythonProject No license field.
npm install is looking for package.json in order to see what it needs to do. Since you dont have it - you get the errors.
See https://docs.npmjs.com/cli/v7/commands/npm-install
Before running npm install, create an npm project.
This can be done with npm init -y
Now you can use npm install <package name>

Angular8 node js and npm installation problems

I'm learning angular js. For this I've install nodejs and git. And I've run following command on CMD:
npm install -g #angular/cli#latest
After some time following error occurred
npm WARN rollback Rolling back #schematics/angular#8.3.21 failed (this is
probably harmless): EPERM: operation not permitted, lstat 'C:\Users\User
Name\AppData\Roaming\npm\node_modules\#angular\cli\node_modules\#schematics'
npm ERR! code EEXIST
npm ERR! path C:\Users\User
Name\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng
npm ERR! dest C:\Users\User Name\AppData\Roaming\npm\ng.ps1
npm ERR! EEXIST: file already exists, cmd shim 'C:\Users\Chaitanya
Kulkarni\AppData\Roaming\npm\node_modules\#angular\cli\bin\ng' ->
'C:\Users\Chaitanya Kulkarni\AppData\Roaming\npm\ng.ps1'
npm ERR! File exists: C:\Users\User Name\AppData\Roaming\npm\ng.ps1
npm ERR! Remove the existing file and try again, or run npm
npm ERR! with --force to overwrite files recklessly.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\User Name\AppData\Roaming\npm-cache\_logs\2020-01-
04T12_12_30_922Z-debug.log
Can you please explain what is that error and how I could solve this. I am using Window 10.
Perform following steps:
Completely uninstall angular-cli from your machine
npm uninstall -g angular-cli
Clean npm cache
npm cache clean --force
Reinstall angular cli,
npm i #angular/cli#latest -g
Run this commands and manually delete the exist files if does not work.
Completely uninstall angular-cli from your machine
npm uninstall -g angular-cli
Clean npm cache
npm cache clean --force
Reinstall angular cli,
npm i #angular/cli#latest -g
Delete this file going to the location.
C:\Users\Chaitanya Kulkarni\AppData\Roaming\npm\ng.ps1
You can try opening the Command Prompt with Administrator privileges and then run the command.
Try to run following command in terminal
npm install -g #angular/cli#latest --force
In the terminal navigate to the following path:
C:\Users\UserName\AppData\Roaming\npm\node_modules
and delete angular file and reinstall cli.
That worked for me.
Also do check if you've set your path variables correctly.

Why does the newest Angular CLI have a corrupted packages?

I installed the latest Node and Angular on Windows 10
npm install npm#latest -g
npm install -g #angular/cli#latest
But when I try to start a project ng new new-project I get the following error
npm WARN tarball tarball data for #angular/compiler#^6.1.0 (sha512-TY6axB1c7VvYXf+ebFDq3Ej+edgii3CDxew8HnyTFAWeDF2Gh8io1vTYwtdyDka6U53ASaheM1HpiUjzvYH0jQ==) seems to be corrupted. Trying one more time.
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\admin\Desktop\...\node_modules\.staging\#angular\common-6be83a81\locales\si.js'
...
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\admin\AppData\Roaming\npm-cache\_logs\2018-10-08T01_01_48_404Z-debug.log
Package install failed, see above.
I tried to uninstall Node.js and Angular CLI completely and then reinstall again
npm install npm#latest -g
npm install -g #angular/cli#latest
But still the same error ..... So I googled this issue. It seems like some people had it too, but then it magically disappeared for some people.
How to fix this?
I was getting the same below error when attempting to a create new project using ng new command.
npm WARN tarball tarball data for #angular/compiler#~7.2.0
(sha512-5yb4NcLk8GuXkYf7Dcor4XkGueYp4dgihzDmMjYDUrV0NPhubKlr+SwGtLOtzgRBWJ1I2bO0S3zwa0q0OgIPOw==)
seems to be corrupted. Trying one more time.
I tried many things but what did not worked and what finally worked for me I have listed below. My working node version is 12.2.0 and npm version is 6.9.0 (i.e. latest version).
What did not worked:
Downgraded node js to other lower versions (tried many version)
Deleted package-lock.json file from project and executed npm install
Executed npm install --registry https://registry.cnpmjs.org instead of npm install
Deleted npm and npm-cache folders from AppData\Roaming and then again installed node js
Deleted node_modules folder, executed npm update and then executed npm install
Executed npm cache clean --force and then executed npm install
Reinstalled #angular/cli
Checked for any firewall / antivirus (in my case it was disabled)
Opened node command prompt as an administrator
Checked user permissions for the project folder
Finally what worked is:
Installed the component for which it was giving error. npm install -global #angular/compiler
I had the same problem with node 12.13.0 and npm 6.13.0
npm WARN tarball tarball data for #angular/compiler#^7.2.11 (sha512-5yb4NcLk8GuXkYf7Dcor4XkGueYp4dgihzDmMjYDUrV0NPhubKlr+SwGtLOtzgRBWJ1I2bO0S3zwa0q0OgIPOw==) seems to be corrupted. Trying one more time.
For me the problem was npm. After upgrading npm to the newest version with npm i -g npm#latest the problem vanished. So it seems to be a problem with npm itself and not the Angular/CLI.
upgrade your NPM version use this command i -g npm#latest it works like magic

Error Message is popping in cmd while installing appium through npm in windows 10

I try to install appium with npm on Windows 10 CMD but I get the following error messages:
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\sample1.bplist'
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\sample2.bplist'
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\uid.bplist'
npm WARN tar ENOENT: no such file or directory, open
'C:\Users\asus\AppData\Roaming\npm\node_modules.staging\bplist-creator-30ee61c3\test\utf16.bplist'
npm ERR! Maximum call stack size exceeded
Looks like you are missing some packages.
Make sure that your package.json has listed all your dependencies
Run npm install
If the issues still persists
Run npm install
Run npm cache clean
Run npm install -g npm
Rub npm install again
You can resolve that issue by following methods:
Just type npm install and hit Enter.
Check issue still exists. and If issue not resolved, continue these methods.
type npm cache clean and hit Enter
type sudo npm install -g npm and hit Enter.
Retry npm install and hit Enter.
If you are behind the company network proxy you can execute the following command on CMD:
npm config set https-proxy http://proxyip:port/

npm ERR! code ENOLOCAL

after making a software to my laptop I installed all the programs includes node js
my OS windows
$ node -v
v8.11.1
and the npm
$ npm -v
v5.6.0
when I tried to install npm globally it's gave me this error :
$ npm install -g
npm ERR! code ENOLOCAL
npm ERR! Could not install from "" as it does not contain a package.json
file.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Aroma\AppData\Roaming\npm-cache\_logs\2018-04-
07T11_10_29_184Z-debug.log
or even when I tried to install it locally to a repository it's gave me:
$ npm install
npm WARN saveError ENOENT: no such file or directory, open
'C:\Users\Aroma\Desktop\app\package.json'
npm notice created a lockfile as package-lock.json. You should commit this
file.
npm WARN enoent ENOENT: no such file or directory, open
'C:\Users\Aroma\Desktop\app\package.json'
npm WARN app No description
npm WARN app No repository field.
npm WARN app No README data
npm WARN app No license field.
up to date in 0.11s
any help would be appreciated
Try this command to change the npm version: npm -g install npm#4.2.0 it works for me on this issue.
I had same problem. I solved in this way.
Step 1: Open the command prompt as an Administrator and run npm install -g create-react-app to solve the npx issue.
Step 2: run npx create-react-app your-app-name
I got the same issue.
What I did was to rename the package-lock.json by:
mv package-lock.json package.json
, and then this issue should be solved.
If you get the next issue of showing a message:
[...] / rollbackFailedOptional: verb npm-session xxxxxxxxxxx
, then you could do
sudo npm config rm proxy
sudo npm config rm https-proxy
sudo npm install npm#latest -g
These steps works for me.
Hope they could be helpful to you too.

Resources