Can't install NPM dependencies on Windows 10 - node.js

Not too sure what's changed with Node.js and NPM recently (i.e. in the last several days) but I can't seem to find a way to install node_modules dependencies for any projects using Node.js on Windows 10 anymore...
My current setup is as follows:
Node.js: v9.5.0
NPM: v5.6.0
Vue.js: v2.9.3
I've tried clearing the cache prior to install: npm cache clear -f
Any time I attempt to run npm i or npm install I'm presented with the following list of errors:
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\.staging\fsevents-a6c1bd51\node_modules\abbrev' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\.staging\abbrev-3ab84c45'
npm ERR! path C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\.acorn.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\mbosse\AppData\Roaming\npm-cache\_logs\2018-02-14T18_27_56_988Z-debug.log
The specified debug.log contains the follow:
19859 warn optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3
(node_modules\fsevents):
19860 warn optional SKIPPING OPTIONAL DEPENDENCY: Error: EPERM: operation not permitted, rename'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.staging\fsevents-a6c1bd51\node_modules\abbrev' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.staging\abbrev-3ab84c45'
19861 verbose optional SKIPPING OPTIONAL DEPENDENCY:
19861 verbose optional Please try running this command again as root/Administrator.
19862 verbose stack Error: ENOENT: no such file or directory, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.acorn.DELETE'
19863 verbose cwd C:\xampp\htdocs\vue-scrolling-table-sample
19864 verbose Windows_NT 10.0.14393
19865 verbose argv "C:\ProgramFiles\nodejs\node.exe" "C:\ProgramFiles\nodejs\node_modules\npm\bin\npm-cli.js" "i"
19866 verbose node v9.5.0
19867 verbose npm v5.6.0
19868 error path C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn
19869 error code ENOENT
19870 error errno -4058
19871 error syscall rename
19872 error enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules\acorn' -> 'C:\xampp\htdocs\vue-scrolling-table-sample\node_modules.acorn.DELETE'
19873 error enoent This is related to npm not being able to find a file.
19874 verbose exit [ -4058, true ]
So it seems, for some reason, NPM is incapable of renaming node_modules dependencies.
I've tried rolling back NPM to earlier version (in case npm#latest is not stable enough).
Using nvm I've completely uninstalled all versions of Node.js and NPM and reinstalled them. I've since tried installing my dependencies on a Node.js v6.11.3 setup as well as a Node.js v8.9.4 with the identical outcome.
Any suggestions would be very beneficial, thank you!

Possible duplicate => npm ERR! Error: EPERM: operation not permitted, rename
Steps:
npm cache clean --force
npm install
If and only IF this doesn't work what I did was erasing the node_modules folder and package-lock.json (if you have the last one) and repeat steps 1 and 2

If possibly you have renamed your package.json and the name does not match your package-lock.json
To resolve this error open your package.json and package-lock.json to check if the "name" key has the same value.
If not change then change them to match your project name.
Example if your project name is todo-list then the "name" value can be todo-list. Note, this is not compulsory.

Related

I accidentally delete directory .npm in my(usr/) home, how do I do

I accidentally delete the "invisible" directory ".npm" in my home directory (even include package.json) on my ubuntu webserver
And I still got an Node.js website running
(it's under /var/www/)
So how do I do to check my npm's status or how do I rebuild it?
Now my site seems working fine but I am so afraid that it will die after I restart something else...
Thanks for your help in advance, and sorry for my stupidity...
Down below is some feedback that npm gave me
root#localhost:/home/alex# npm restart
npm ERR! Linux 4.15.0-112-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "restart"
npm ERR! node v8.10.0
npm ERR! npm v3.5.2
npm ERR! path /home/alex/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/alex/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/home/alex/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! Please include the following file with any support request:
npm ERR! /home/alex/npm-debug.log
root#localhost:/home/alex# npm install
npm WARN enoent ENOENT: no such file or directory, open '/home/alex/package.json'
npm WARN alex No description
npm WARN alex No repository field.
npm WARN alex No README data
npm WARN alex No license field.
The .npm directory is a cache so deleting it shouldn't affect anything running on your system.
The missing package.json file is a bigger deal potentially, but I suspect you are simply in the wrong directory. One typically doesn't have a package.json at the root level of their home directory (in your case, /home/alex). If I'm right about that, then the answer is to find out where the real package.json is.
If on the other hand, it really was in your home directory, and you don't have a backup of your home directory, then you'll need to regenerate it however you managed to create it in the first place. (And while you're at it, create a backup system so you're not in this situation again!)
I also see you are running Node.js 8.x. That version of Node.js was last supported in 2019. You are running a version of Node.js with known TLS/SSL vulnerabilities. Update to 12.x at least, and preferably 14.x.

Installing puppeteer results in "file already exists" error

When I first tried to install puppeteer through npm, I got errors saying permission is denied for the .local-chromium folder. So I followed this SO post and that error went away, but now there is another (base path is omitted):
$ sudo npm install puppeteer --unsafe-perm=true
> puppeteer#5.2.1 install ##########/node_modules/puppeteer
> node install.js
(node:25349) ExperimentalWarning: The fs.promises API is experimental
Downloading Chromium r782078 - 126.4 Mb [====================] 100% 0.0s
ERROR: Failed to set up Chromium r782078! Set "PUPPETEER_SKIP_DOWNLOAD" env variable to skip download.
{ [Error: EEXIST: file already exists, mkdir '##########/node_modules/puppeteer/.local-chromium/linux-782078']
errno: -17,
code: 'EEXIST',
syscall: 'mkdir',
path:
'##########/node_modules/puppeteer/.local-chromium/linux-782078' }
npm WARN notsup Unsupported engine for puppeteer#5.2.1: wanted: {"node":">=10.18.1"} (current: {"node":"10.4.0","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: puppeteer#5.2.1
npm WARN notsup Unsupported engine for extract-zip#2.0.1: wanted: {"node":">= 10.17.0"} (current: {"node":"10.4.0","npm":"6.14.7"})
npm WARN notsup Not compatible with your version of node/npm: extract-zip#2.0.1
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! puppeteer#5.2.1 install: `node install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the puppeteer#5.2.1 install 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:
npm ERR! ######/.npm/_logs/2020-07-30T16_32_37_096Z-debug.log
But that directory doesn't exist, nor does puppeteer at all within node_modules so I can't delete it and retry. I'm not sure what the installation is reffering to. Does anybody have any idea what it could mean?
Also, this is irrelevant but another concern is with the warnings saying that a node version >=10.18.1 is wanted and so 10.4.0 is unsupported, any ideas what's up with that as well?
I ended up using nvm to switch to the stable Node release (10.18.1) which resolved both the errors and the warnings. I guess there was some incompatibility with newer Node versions.

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

Throwing error while executing npm install marialsql

I would need your help in resolving below error.
I am trying to build an angular project with mariasql as it is the backend db
In order to do that: I tried following steps
Step-1: I installed windows production tool with following command
line as maria db requires Microsoft Visual studio compiler
`"npm install --global windows-build-tools"`
After step-1, I have got visual studio and python 2.7 in my laptop when i installed the global windows build tools
Step-2: I set PYTHON Environment variable in my system
Step 3: I created a brand new angular project like below
ng new selenium-package
The project got created with node_modules
Step 4: I tried installing marialsql as below
npm install mariasql
With this, I am getting below error:
C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-package\node_modules\mariasql> if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "node C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-automation-builder\node_modules\node-gyp\bin\node-gyp.js" rebuild ) module.js:557
throw err;
^
Error: Cannot find module 'C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-package\node_modules\mariasql\node C:\Users\Jack\Documents\Tuitorial\Exercise\selenium-automation-builder\node_modules\node-gyp\bin\node-gyp.js'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Function.Module.runMain (module.js:701:10)
at startup (bootstrap_node.js:194:16)
at bootstrap_node.js:618:3 npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.3 (node_modules\fsevents): npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! mariasql#0.2.6 install: `node-gyp rebuild` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the mariasql#0.2.6 install 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: npm ERR! C:\Users\Jack\AppData\Roaming\npm-cache\_logs\2017-12-22T04_49_00_804Z-debug.log

Why there exist error when I run npm install --no-bin-links?

I use :
Laravel 5.4
Windows 10
Node version : v6.11.1
Npm version : 5.3.0
If I run : npm install --no-bin-links
There exist error :
npm WARN deprecated express#2.5.11: express 2.x series is deprecated
npm WARN deprecated connect#1.9.2: connect 1.x series is deprecated
npm ERR! path C:\xampp\htdocs\myshop\node_modules\bs-recipes
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\myshop\node_modules\bs-recipes' -> 'C:\xampp\htdocs\myshop\node_modules\.bs-recipes.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\windows10\AppData\Roaming\npm-cache\_logs\2017-08-30T00_41_20_491Z-debug.log
How can I solve the error?
Update :
I uninstall Node version : v6.11.1 and install the new version, v8.4.0, but it's the same
I'm not familiar with this error but the console output clearly states:
npm ERR! enoent ENOENT: no such file or directory, rename 'C:\xampp\htdocs\myshop\node_modules\bs-recipes' -> 'C:\xampp\htdocs\myshop\node_modules\.bs-recipes.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
Try the following:
Restart your computer.
If you are using visual studio code, close it. And run npm install via console.
If you are using visual studio code, update it to the latest version.
Find that file in the error and rename it, as the error suggests.
Tip: Always read the error message. Most of the time it will tell you what the problem exactly is.
Update
Try checking this similar issue on github: npm 17444

Resources