Can't install clean-webpack-plugin for nodejs - node.js

npm install --save-dev clean-webpack-plugin
produces the following error:
npm ERR! path /home/dovetail/dealware/node_modules/latest/node_modules/npm/node_modules/dezalgo/node_modules/asap
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/home/dovetail/dealware/node_modules/latest/node_modules/npm/node_modules/dezalgo/node_modules/asap' -> '/home/dovetail/dealware/node_modules/latest/node_modules/npm/node_modules/dezalgo/node_modules/.asap.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
Have tried:
Wiping the node_modules directory and npm install
Checking file permissions.
Node version: 8.11.4
NPM version: 5.6.0

Your issue looks like the ones mentioned in this thread: https://github.com/npm/npm/issues/17444
You are probably hitting an issue of npm itself or between npm and another process on your system.
Issues in npm itself are mostly fixed by upgrading npm. (Sometimes by downgrading...)
Scanning the issue thread indicates your issue could very well be your ide, a virus scanner, or another (npm?) process that is running in the background. Quitting these processes could fix your problem.
Some people mention deleting package-lock.json fixes the problem, but keep in mind this deletes important information about the versions of your installed packages so make a backup first.

Fixed.
Downgraded from npm 6 to npm 5.2.0

Related

I can't use "create-react-app" ("This is related to npm not being able to find a file.")

I tried every single thing I've found, but I just can't run create-react-app. I tried to uninstall node and install again, use yarn, clean cache, create with "npm init ..." but nothing works.
Microsoft Windows [versão 10.0.19043.1889]
(c) Microsoft Corporation. Todos os direitos reservados.
C:\Program Files (x86)\Windows Resource Kits\Tools>cd C:\Users\user\meu_app
C:\Users\user\meu_app>node -v
v16.17.0
C:\Users\user\meu_app>npm -v
8.18.0
C:\Users\user\meu_app>npx create-react-app myapp
npm ERR! code ENOENT
npm ERR! syscall spawn C:\Users\user
npm ERR! path C:\Users\user\meu_app
npm ERR! errno -4058
npm ERR! enoent spawn C:\Users\user ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user\AppData\Local\npm-cache\_logs\2022-09-02T19_06_17_314Z-debug-0.log
I have never seen this issue before. npx is distributed with npm 5.2+, so that shouldn't be the issue. It seems your issue is similar to this one Can't install any NPM package, error 4058
Try these steps:
Delete package-lock.json and run NPM again (probably can skip this one if it does not pertain to your issue)
Ensure no other processes of node.js are running (check task manager)
If you are using visual studio code, close it and try running npm install again.
If all else fails, restart your computer.
See thread here: https://github.com/npm/npm/issues/17444
Let me know if that helps; otherwise, I will keep looking.

Windows 11 - npm ERR! errno -4058 - code ENOENT bash

Got this very annoying NPM issue out of nowhere, though I must say I had a few weeks break from playing with my project.
Actual version of core-js.
npm ERR! code ENOENT
npm ERR! syscall spawn bash
npm ERR! path C:\Users\User1\Documents\project11\node_modules\**#angular\cli**
npm ERR! errno -4058
npm ERR! enoent spawn bash ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
This npm ERR! errno -4058 seems to be rather common issue, but I've found no success and am getting a bit worried, I've tried all possible solutions I've found online (below)
Delete package-lock + node modules + npm cache and then run npm install
Use yarn instead of NPM (installation succeeds but can't run project)
Reinstall node and npm completely
Test with different (newest) npm & node versions
Test building only production version
Restart computer
Close all vscode applications etc. that could use npm
Run cmd as admin
Check windows defender if it could block npm
Make sure system32 is correctly set in env. variables
Hox, the erro says angular-cli, but if I somehow manage to get through that, it will just complain about the next library
Edit: Workaround for me seems to be to run npm in git-bash
For some reason I can't use powershell nor CMD anymore to run NPM, but that's not a big issue.
Funny. Before I posted this question, I already had spent well over 5 hours testing everything I found online. Immediately after posting this question, I, just for the sake of it, tested running npm install in "git-bash".
And.. it worked, so if somebody else is having issues with this, try running npm install in git bash https://gitforwindows.org/ instead
And of course you can try the things I tried above

npm install always gives 'Your cache folder contains root-owned files, due to a bug in npm previous versions of npm which has since been addressed.'

I am currently using Ubuntu 18.04.4 and I am trying to install something using npm install but it always gives the error below. I tried other aliases as well (npm i, npm add) but the error persists.
npm install
npm ERR! code EPERM
npm ERR! syscall open
npm ERR! path /home/dell/.npm/_cacache/content-v2/sha512/14/21/2143fe2b135cd8bfdad85c9c3f9ac46ab279a58dee631cfea1b9678167bd388d44f2d36739019c96ba3a4c4756b1ea6570f4dc8931fb8ad8230359521f80
npm ERR! errno -1
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR! sudo chown -R 1001:1001 "/home/dell/.npm"
npm ERR! A complete log of this run can be found in:
npm ERR! /home/dell/.npm/_logs/2020-07-30T17_16_58_257Z-debug.log
When I run the sudo chown -R 1001:1001 "/home/dell/.npm" command, it does nothing, and the error remains when I run npm install again. I have also searched StackOverflow and other platforms for the answer, but no solution seems to solve this problem.
P.S: My node version is 12.18.3 and npm version is 6.14.6.
If someone can help me resolve this, I would really appreciate it!
I had problem with create-react-app. Solve it using yarn.
yarn global remove create-react-app
then
yarn global add create-react-app
and
create-react-app MyApp

NPM install current application globally (e.g. npm install -g .)

I am working on a package that is mean to be used globally and I want to install it globally before publishing it.
I've tried to use npm i -g . but it always fails due to files not being found
npm ERR! code ENOENT
npm ERR! syscall access
npm ERR! path /home/ivan/lux2/cli/node_modules/file-uri-to-path
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, access '/home/ivan/lux2/cli/node_modules/file-uri-to-path'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ivan/.npm/_logs/2020-04-29T01_38_22_536Z-debug.log
I've tried this on a couple of different global npm package I'm working on all have the same result. I created a new package and it did work, is it something weird about the failing module (I've also seen bindings, nan and fsevents with this same error)
If I try creating those directories (they are not in my dependencies) I just end up finding more missing directories.
Any help would be appreciated.
Make sure you are running this command in a correct path and try to run command like this - npm install libraryName -g

npm (version 5.5.1) install errors

I have installed node version 9.2.0 and npm version 5.5.1
On the command line, I want to install packages:
$ npm install express --save
npm WARN bookstore#1.0.0 No repository field.
npm ERR! path C:\Users\ad\Projects\bookstore\node_modules\bytes
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename
'C:\Users\ad\Projects\bookstore\node_modules\bytes' ->
'C:\Users\ad\Projects\bookstore\node_modules\.bytes.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\ad\AppData\Roaming\npm-cache\_logs\2018-03-
14T06_36_04_014Z-debug.log
What does this mean? Maybe I should uninstall node version 9 and revert to the LTS-version 8? And how to do that in Windows?
Please, I need help; thank you in advance!
EDIT: Could it be caused by a slow internet connection; npm not being able to find a file.?
EDIT 2: I was able to uninstall node version 9.2.0, then installed version 8.10.0 :-( Still the same error messages!
First Use Below Command
touch .npmignore
Then Install Express
npm install express --save
I found a solution, but this is really stupid! Let me explain: I have been using Visual Studio Code for months now, and it's inbuilt command line (bash). Never had any issues with it!
But now; there must be something wrong with VS Code, giving these errors.
I tried an alternative: Git-Bash command window and separately Sublime Text 3. And it works! I could install all dependencies that were needed, without any errors or warnings!
Can someone explain this strange behavior I had using VS Code?

Resources