NPM multiple install errors - node.js

When I try to install npm the console gives the following errors & warnings:
npm WARN checkPermissions Missing write access to C:\Users\Aristophanes\node_modules\web3
npm WARN ajv-keywords#2.1.1 requires a peer of ajv#^5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#2.1.0 requires a peer of babel-eslint#^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#2.1.0 requires a peer of eslint#^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader#1.9.0 requires a peer of eslint#>=1.6.0 <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jsx-a11y#5.1.1 requires a peer of eslint#^2.10.2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
npm WARN firebase-functions#2.1.0 requires a peer of firebase-admin#~6.0.0 but none is installed. You must install peer dependencies yourself.
npm ERR! path C:\Users\Aristophanes\node_modules\web3
npm ERR! code ENOENT
npm ERR! errno -4058
npm ERR! syscall access
npm ERR! enoent ENOENT: no such file or directory, access 'C:\Users\Aristophanes\node_modules\web3'
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\Aristophanes\AppData\Roaming\npm-cache\_logs\2018-11-02T23_13_12_948Z-debug.log
Does anyone know how I can fix this? Thank you.

Try removing the web3 folder in C:\Users\Aristophanes\node_modules\web3, as well as the node_modules folder in your project directory (if exists). Hope it will help you :)

There are 2 solutions for this.
**1. Reinstall npm with a Node version manager (recommended).**
This is the best way to avoid permissions issues. For more information, refer this link
(https://docs.npmjs.com/getting-started/installing-node#using-a-version-manager-to-install-nodejs-and-npm)
You do not need to remove your current version of npm or Node.js before installing a Node version manager.
**2. Change npm's default directory manually.**
If you're not using windows you can use below steps.
To minimize the chance of permissions errors, you can configure npm to use a different directory. In this example, it will be a hidden directory on your home folder.
Back-up your computer before you start.
Make a directory for global installations:
mkdir ~/.npm-global
Configure npm to use the new directory path:
npm config set prefix '~/.npm-global'
Open or create a ~/.profile file and add this line:
export PATH=~/.npm-global/bin:$PATH
Back on the command line, update your system variables:
source ~/.profile
Test: Download a package globally without using sudo.
npm install -g jshint
Instead of steps 2-4, you can use the corresponding ENV variable (e.g. if you don't want to modify ~/.profile):
NPM_CONFIG_PREFIX=~/.npm-global

Related

I am creating an Node.js app and I need to install ejs but I am unable to install it. It is showing me the following error

node --harmony ./postinstall.js
'node' is not recognized as an internal or external command,
operable program or batch file.
npm WARN #react-navigation/core#3.7.5 requires a peer of react#* but
none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view#0.14.9 requires a peer of react#*
but none is installed. You must install peer dependencies yourself.
npm WARN react-native-safe-area-view#0.14.9 requires a peer of
react-native#* but none is installed. You must install peer
dependencies yourself.
npm WARN react-navigation#4.3.7 requires a peer of react#* but none is
installed. You must install peer dependencies yourself.
npm WARN react-navigation#4.3.7 requires a peer of react-native#* but
none is installed. You must install peer dependencies yourself.
npm WARN ashutosh#1.0.0 No description
npm WARN ashutosh#1.0.0 No repository field.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! ejs#3.1.3 postinstall: node --harmony ./postinstall.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the ejs#3.1.3 postinstall 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\Ashutosh\AppData\Roaming\npm-cache_logs\2020-05-22T23_26_50_117Z-debug.log
You need to have a path to NodeJS inside your environment variables list.
On some OS reboot might be needed to make this work.
Try reboot or reinstall NodeJS and then reboot.

Unable to install vue-onsenui due to peer dependencies

I'm trying to install vue-onsenui using npm install vue-onsenui --save in my project folder. I get the following message but I don't know how to fix it. I've tried npm install ansistyles but that didn't work either.
npm install vue-onsenui --save
npm WARN vue-onsenui#2.4.3 requires a peer of vue#~2.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN network.pack.app_user#1.0.0 No repository field.
npm ERR! path /Users/BenFransen/code/pack-app/node_modules/npm/node_modules/ansistyles
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall rename
npm ERR! enoent ENOENT: no such file or directory, rename '/Users/BenFransen/code/pack-app/node_modules/npm/node_modules/ansistyles' -> '/Users/BenFransen/code/pack-app/node_modules/npm/node_modules/.ansistyles.DELETE'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
The path in the error looks strange - have you added npm as a dependency of your project?
npm is generally installed globally and used via the command line - it's usually not needed as a dependency of your project unless you're programatically using npm in your project (is that the case?)
Try removing the node_modules directory (and possibly package-lock.json) and rerunning npm install in your project directory before adding vue-onsenui again - sometimes resetting things like that can help.
On a separate note, the peer dependencies warning is saying you need to have vue as a dependency in your project in order to use vue-onsenui, so make sure that is there as well.

Sodium fails to install when on Raspberry Pi

When trying to install Sodium with NPM on my Raspberry Pi, the installation always fails and complains that it does not have write access to /home/Captain/node_modules/libsodium. I'm running the installation command through sudo, and the install still doesn't want to work. Did I just royally mess up my install?
$ sudo npm install sodium
npm WARN checkPermissions Missing write access to /home/Captain/node_modules/libsodium
npm WARN enoent ENOENT: no such file or directory, open '/home/Captain/package.json'
npm WARN discord.js#11.2.1 requires a peer of erlpack#hammerandchisel/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of node-opus#^0.2.6 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of opusscript#^0.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of libsodium-wrappers#^0.5.4 but none is installed. You must install peer dependencies yourself.
npm WARN discord.js#11.2.1 requires a peer of uws#^0.14.5 but none is installed. You must install peer dependencies yourself.
npm WARN Captain No description
npm WARN Captain No repository field.
npm WARN Captain No README data
npm WARN Captain No license field.
npm ERR! path /home/Captain/node_modules/libsodium
npm ERR! code ELOOP
npm ERR! errno -40
npm ERR! syscall access
npm ERR! ELOOP: too many symbolic links encountered, access '/home/Captain/node_modules/libsodium'
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2017-11-21T02_23_41_242Z-debug.log
no, your setup is fine.
try this command
sudo chmod 777 /home/Captain/node_modules/libsodium
that should fix it.
EDIT: I know this is a 2 year old answer but I would like to tell people who stumble across this post to NEVER use 777! 777 allows anyone to read, write and execute your file, you SHOULD use 644 which allows anyone to read the file only while you can read and write said file.

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.

what the location of the folder packages when installing npm directive

I am trying to install the "#ngui"- folder packages of angular.
It downloaded the folder, but when I try to install the folder in the cmd like this:
#ngui/ngui #types/googlemaps #types/hammerjs --save-dev
I got this error:
npm WARN #angular/compiler-cli#4.4.3 requires a peer of #angular/compiler#4.4.3 but none was installed.
npm WARN #angular/compiler-cli#4.4.3 requires a peer of #angular/core#4.4.3 but none was installed.
npm ERR! Cannot read property '0' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\moshel\AppData\Roaming\npm-cache_logs\2017-09-27T07_39_55_977Z-debug.log
PS C:\Users\moshel\Workspaces\Aman.Magar.Maply\WebUI> npm install #ngui/dist/ngui #types/googlemaps #types/hammerjs --save-dev
Maybe this is because the folder is not in the correct location?
Does anyone know where I need to put the folder that I downloaded?

Resources