NPM Insall error (Angular 6) - node.js

I have an Angular 6 project and when I try to execute it, it throws the following error:
Could not find module "#angular-devkit/build-angular" from "C:\\Users\\fernando.cavalcante\\Desktop\\Fernando_Backup\\VisualStudio2017\\Projects\\GerenciadorDiretorioAPI\\Presentattion".
Error: Could not find module "#angular-devkit/build-angular" from ...
I tried to update the packages but when I run npm install command, cmd throws the following message:
npm WARN tar ENOENT: no such file or directory, open 'C:\Users\me\Desktop\Folder1\Projects\My.Project\Developing\0 - Presentation\My.Project\node_modules\.staging\es5-ext-b75d419b\test\reg-exp\#\sticky\is-implemented.js'
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: 403 Forbidden: fsevents#https://registry.npmjs.org/fsevents/-/fsevents-1.1.3.tgz
npm ERR! code EINTEGRITY
npm ERR! sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q= integrity checksum failed when using sha1: wanted sha1-PFtv1/beCRQmkCfwPAlGdY92c6Q= but got sha1-pMeCeEFUzmIX1LXY6ZTg7bwjcDY=. (4472399 bytes)
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\me\AppData\Roaming\npm-cache\_logs\2018-05-18T13_11_28_030Z-debug.log
I searched some solutions here, here, here and here, tried to reinstall Node, reinstall Angular and even searched in some unresolved questions but nothing worked for me.
I also tried this solution and run npm clean cache -f but didn't work.
I don't know how to proceed.
I'm using Angular CLI: 6.0.1 and Node: 8.11.2

Delete package-lock.json, even with #angular/cli # version 7, I'm using version 6, and was having the same issue. Deleting the package-lock.json fixed this error for me. There was no need to delete node_modules as it would not even install any packages, but only throw errors.

Delete your node_modules folder. rm -rf node_modules
Delete your package.lock.json file.
Might want to update your angular cli.
npm install -g #angular/cli#latest
or first run npm uninstall -g #angular/cli then npm install -g #angular/cli#latest
Now run npm install.

Install dev dependency.
npm install --save-dev #angular-devkit/build-angular
Is a new package in Angular 6

Related

i have error install angular and npm package

I delete the old version of angular and trying to install a new one after update Nodejs and get this error
this error appears when trying to install angular
i trying to resolve by this steps and get different error
1) npm cache verify (If not running, add --force)
2) npm uninstall -g #angular/cli
3) check node --version and ng --version
4) npm i -g #angular/cli#latest
5) npm install --save-dev #angular/cli#latest
5) Delete node_modules and run npm install
6) Kill all instances of terminal
error :
admins-MacBook-Pro:~ admin$ sudo npm i -g #angular/cli#latest
npm ERR! path /usr/local/bin/ng
npm ERR! code EEXIST
npm ERR! Refusing to delete /usr/local/bin/ng: ../lib/node_modules/angular-cli/bin/ng symlink target is not controlled by npm /usr/local/bin
npm ERR! File exists: /usr/local/bin/ng
npm ERR! Move it away, and try again.
npm ERR! A complete log of this run can be found in:
npm ERR! /Users/admin/.npm/_logs/2019-08-01T03_26_03_978Z-debug.log
admins-MacBook-Pro:~ admin$ npm install
npm WARN saveError ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN admin No description
npm WARN admin No repository field.
npm WARN admin No README data
npm WARN admin No license field.
up to date in 1.274s
found 0 vulnerabilities
admins-MacBook-Pro:~ admin$ sudo npm install
npm WARN saveError ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN enoent ENOENT: no such file or directory, open '/Users/admin/package.json'
npm WARN admin No description
npm WARN admin No repository field.
npm WARN admin No README data
npm WARN admin No license field.
up to date in 1.199s
found 0 vulnerabilities
Try:-
Add sudo if on Mac.
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. If
you're sure you want to delete the entire cache, rerun this command
with --force.
Delete current project and create one new:-
A) ng new PROJECTNAME
then,
1) npm cache verify (If not running, add --force)
2) npm uninstall -g #angular/cli
3) check node --version and ng --version
4) npm i -g #angular/cli#latest
5) npm install --save-dev #angular/cli#latest
6) Delete node_modules and run npm install
7) Destroy all instances of terminal.
and,
Delete package.lock.json.
Create package.json by running `npm init`, then follow step 6
If your project is opened, then try closing vscode or whatever code editor and then try installing again.

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

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.

npm ERR! Refusing to delete / code EEXIST

I'm just running a simple npm install and i get this error.
npm ERR! path /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which
npm ERR! code EEXIST
npm ERR! Refusing to delete /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which: is outside /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/which and not a link
npm ERR! File exists: /Users/jasonazoulay/Desktop/fabrick.io/delegation/node_modules/#angular/cli/node_modules/webpack/node_modules/yargs/node_modules/os-locale/node_modules/execa/node_modules/cross-spawn/node_modules/.bin/which
npm ERR! Move it away, and try again
This is the first time I get this error and I don't know what to do.
Steps
Delete the node_modules directory completely.
Run npm install again.
This should help.
This was how I solved mine after 'googling' around...
Navigate to the directory your node was installed in
rename your npm.cmd and npm files
Try run the installation again
If successful..delete the files you renamed earlier npm and npm.cmd
if not, :( :(
The cli commands here...in case you don't want to be renaming and stuffs
cd %ProgramFiles%\nodejs
ren npm.cmd npm2.cmd
ren npm npm2
npm2 install npm#latest -g
del npm2
del npm2.cmd
Rolf-schmidiger
Try running npm update -g npm then run npm i again.
If that doesn't work maybe npm cache clean helps.
If that doesn't work either you should consider removing the node_modules folder in your application and running npm i again.
If you still have no luck, I suggest removing the package-lock.json and the node_modules folder before running npm i.
For windows users (specific to windows 10) this must solve the problem.
Goto this folder:
C:\Users\[UserName]\AppData\Roaming\
delete or rename the npm and npm-cache folders.
This has fixed my problem in Windows.
I got this problem on Linux (npm is the current latest 5.6.0), because I created a tgz archive, and I needed to --dereference some symlinks (see man tar) when creating a tgz archive (which was them copied to VM for testing). This way a lot of symlinks in node_modules/.bin also became regular files.
npm says in the error message, .e.g.
npm ERR! Refusing to delete /path/to/node_modules/.bin/jest: is outside /path/to/node_modules/jest and not a link
This worked for me
npm install -g --force gatsby-cli
Thanks
I had a similar issue but was because initially the project was installed with
yarn install
Then when I tried to install dependencies using
npm install
I caught this same error. So ensure to use only one: yarn or npm. I fixed it by adding my dependency with
yarn add <vendor_name>
but the same works if you use npm instead, you need to add a dependency.
Uninstall node.js from control panel
Delete below folders
C:\Program Files (x86)\Nodejs
C:\Program Files\Nodejs
C:\Users\{User}\AppData\Roaming\npm (or %appdata%\npm)
C:\Users\{User}\AppData\Roaming\npm-cache (or %appdata%\npm-cache)
C:\Users\{User}\.npmrc (and possibly check for that without the . prefix too)
C:\Users\{User}\AppData\Local\Temp\npm-*
Install node.js again
I had a similar error(mine is not #angular),
resolved by deleting and reinstalling node with installer.
I had the same problem and it turned out the problem was that a stray instance of npm was running somewhere in the background at the same time I was trying to do the install (it was Webpack's npm run serve, to be precise).
Stopping the running instance resolved the problem.
I had a similar problem and what seems to have worked is to uninstall npm and reinstall it, making sure to be logged in as the correct user for the reinstall. I think I previously installed npm as root, but was updating a package as a regular (sudo) user.
I had this problem when working on a virtual, encrypted disk.
Moving the project to a regular disk solved the problem.
I the same error but when I was trying to update module "cordova" to version 9. I fixed it by forcing the install with --force. The npm command I used:
npm i -g --force cordova#9
I downgraded my node version to 10 with nvm, and it installed a newer version of npm (v6) during the process. After that, the package was installed w/o errors. So it's either npm or node version.
In my case, when trying to install for example the program mermaid-cli, and with npm being already installed,
npm install #mermaid-js/mermaid-cli
threw the error in question.
When I added --force, the output was just shortened, but the same error:
$ sudo npm install #mermaid-js/mermaid-cli --force
npm WARN using --force I sure hope you know what you are doing.
npm WARN enoent ENOENT: no such file or directory, open '/home/MY_USER/package.json'
npm WARN MY_USER No description
npm WARN MY_USER No repository field.
npm WARN MY_USER No README data
npm WARN MY_USER No license field.
npm ERR! code EEXIST
npm ERR! path /home/MY_USER/node_modules/npm/node_modules/.bin/rimraf
npm ERR! Refusing to delete /home/MY_USER/node_modules/npm/node_modules/.bin/rimraf: is outside /home/MY_USER/node_modules/npm/node_modules/rimraf and not a link
npm ERR! File exists: /home/MY_USER/node_modules/npm/node_modules/.bin/rimraf
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! /root/.npm/_logs/2022-02-03T13_41_52_634Z-debug.log
I then followed the accepted answer that says that you only need to remove and install npm again and therefore removed the directory node_modules from my home directory where it was installed.
Yet, I still ran into the error when running npm install:
$npm install
npm WARN saveError ENOENT: no such file or directory, open '/home/MY_USER/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/MY_USER/package.json'
npm WARN MY_USER No description
npm WARN MY_USER No repository field.
npm WARN MY_USER No README data
npm WARN MY_USER No license field.
up to date in 0.865s
found 0 vulnerabilities
The easy fix for this was to just install the program with npm again when npm 'node_modules are removed! I happened to find out about by entering the command although npm's node_modules were removed. Ran through.
Logs:
$npm install #mermaid-js/mermaid-cli
> puppeteer#13.1.3 install /home/MY_USER/node_modules/puppeteer
> node install.js
Downloading Chromium r950341 - 142 Mb [====================] 100% 0.0s
Chromium (950341) downloaded to /home/MY_USER/node_modules/puppeteer/.local-chromium/linux-950341
npm WARN saveError ENOENT: no such file or directory, open '/home/MY_USER/package.json'
npm WARN notsup Unsupported engine for commander#8.3.0: wanted: {"node":">= 12"} (current: {"node":"10.19.0","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: commander#8.3.0
...
npm WARN MY_USER No description
npm WARN MY_USER No repository field.
npm WARN MY_USER No README data
npm WARN MY_USER No license field.
+ #mermaid-js/mermaid-cli#8.13.10
added 147 packages from 94 contributors and audited 147 packages in 26.338s
10 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
Wrap up:
If npm install fails, install whatever program you like or dislike, but install one program with the npm command even if you just have removed npm's node_modules directory. It will download the node_modules again and in my case, the program worked.

Local grunt installation gives error

npm install -g grunt-cli //done successfully
npm install grunt --save --only=dev
gives following error
(node:11000) fs: re-evaluating native module sources is not supported. If
you are using the graceful
-fs module, please update it to a more recent version.
npm WARN prefer global coffee-script#1.10.0 should be installed with -g
project#1.0.0 C:\Users\Live\Desktop\node grunt\final
`-- (empty)
npm WARN project#1.0.0 No repository field.
npm ERR! code 1
Tried uninstalling grunt-cli, cleaning npm cache, then re-installing, but still the problem persists.
Ok short recap:
When in doubt remove your node_modules and install all packages again using npm install
If that didn't work, try updating your npm by executing npm update -g npm and redo step 1.
If that didn't solve your problem, try upgrading to another NodeJS version using nvm or n.

Resources