npm install can't find file (intermittently) in vagrant running on osx - node.js

I'm running npm in an ubuntu vagrant box. When running npm install or installing webpack or webpack-cli or babel core I keep running into the error
npm ERR! enoent ENOENT: no such file or directory, open '/var/www/html/app/client/node_modules/loader-utils/node_modules/minimist/package.json.3207661308'
npm ERR! enoent This is related to npm not being able to find a file.
babel core has previously installed in this same setup, but almost every time I run npm install it fails.
I suspect this is todo with file sharing between vagrant and osx or permissions issues. But this setup is the same as another (none nodejs) setup which works flawlessly.
I'm running the latest node 10 and the latest ubuntu/xenial64.

I never found an answer to this. But found a work around by using yum instead of npm. I would recommend using yum over npm in all situations now.

Related

npm Install error- node modules but no package-lock.json

I'm getting an error with my npm install and would love some help/advice.
ELIFECYCLE
ENOENT
spawn bash
yorkie#2.0.0 install `node bin/install.js`
spawn bash ENOENT
Failed at the yorkie#2.0.0 install script
This is probably not a problem with npm. There is likely additional logging output above.
My node path is set in my environmental variables. My node version is 10.24.1 and npm version is 6.4.1
I am using nvm for windows to manage versions.
Whenever I run npm install I get this error, and node modules is created, but package-lock is not.
I have deleted node modules and ran npm cache clear with no success.
Any tips appreciated!
Try and run the following command.
npm install --registry=https://registry.npm.taobao.org
If that doesn't work, see the following Issues page on GitHub.
yorkie#2.0.0 error
EDIT: Just noticed, you should update your Node.js version. It is on v10 and the current LTS version (at the time posted) is v16. This is just a suggestion, although it might solve your issue.
This solved it for me!
npm config delete script-shell
Source: https://stackoverflow.com/a/46006249/15787997

Failed at the bcrypt#3.0.2 install script

I am installing bcrypt for my project to use salting in hash function using the command -
npm i bcrypt#3.0.2
My current node version is 10.16.0
I have installed nvm to update my previous node version from 10.15.3
but while installing I am getting these errors-
"node" is not recognized as an internal or external command,
operable program or batch file.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! bcrypt#3.0.2 install: "node-pre-gyp install --fallback-to-build"
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the bcrypt#3.0.2 install script
npm ERR! This is probably not a problem with npm, There is likely additional logging output above.
npm ERR! A complete log og this run can be found in:
npm ERR! C:Users\Ansh\AppData\Roaming\npm-cache\_logs\2019-06-17T06_05_15-252Z-debug.log
Update
I have managed to install the bcrypt package but the issue mentioned is still present. Actually, I am using windows OS and for running these commands I was using Hyper as terminal, which is creating these errors. I tried to run the bcrypt install command using Administrative privileges through PowerShell and it was successful, without any errors.
I tried to install a few more packages(like passport, express-session, etc) through Hyper and I am facing somewhat similar errors, but when I run those in PowerShell, it works just fine.
I have managed to make things work for me, but I still don't understand the logic behind this. If anyone has any idea about it, please share and then I can close this.
There are a lot of bug reports at the official repository about this - have you made sure that you've read the full installation instructions for this library, including the installation of some build tools? Maybe running the following line in a command line with admin privileges already helps?
npm install --global --production windows-build-tools
hi try this command line maybe its will help you
npm install bcrypt#3 --save

npm WARN: npm does not support Node.js v12.4.0

I've been getting the following warnings lately whenever I run any npm script:
npm WARN npm npm does not support Node.js v12.4.0
npm WARN npm You should probably upgrade to a newer version of node as we
npm WARN npm can't make any promises that npm will work with this version.
npm WARN npm Supported releases of Node.js are the latest release of 6, 8, 9, 10, 11.
npm WARN npm You can find the latest version at https://nodejs.org/
It says that I should upgrade to a newer version, but v12.4 is the newest version. Even though the scripts run fine, I think there's no guarantee and something might break at any moment.
I've also tried updating npm in case there's a newer version using npm install npm -g but got the error:
npm ERR! path /usr/local/Cellar/node/12.4.0/lib/node_modules/npm
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'] {
npm ERR! stack: 'Error: EACCES: permission denied, access ' +
npm ERR! "'/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'",
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/Cellar/node/12.4.0/lib/node_modules/npm'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator (though this is not recommended).
Then I've seen that Homebrew version of npm can't be updated using npm itself, so I tried updating through Homebrew using brew upgrade npm but got this error:
Error: npm 12.4.0 already installed
For some reason Brew mixes up nodes and npms versions.
What am I doing wrong and how can I get rid of this warning?
What worked for me:
if you try running this command "npm cache clean -f" and it doesn't work,
on your windows machine(mine is windows 10)
access the "npm" and "npm-cache" folders in this location "~\AppData\Roaming\"
delete these two folders "npm" and "npm-cache".
go to your windows search bar and search for Node, right click to open file location, run the uninstaller to uninstall NodeJs.
then visit nodejs.org and download and install node again, if you've already downloaded it, visit the folder where you downloaded it to reinstall it.
after installation, check your version of npm by typing "npm -v" on your command terminal to see the new updated version of npm installed on your machine.
now you're all set, Happy coding.
Seems like you messed up with permissions in /usr/local.
Here is how to fix that:
Fix /usr/local permissions:
sudo chown -R `id -un`:`id -gn` /usr/local
Clean npm cache and uninstall it:
npm cache clean -f
npm -g uninstall npm
Reinstall node (with npm)
brew reinstall node
Upgrade npm:
npm -g i npm
That should bring npm#6.9.2.
You should avoid using sudo while installing software with brew or npm, that could cause issues like this.
If you have nvm you may have an issue in which your node version installed at a certain version didn't match.
For example, I accidentally used: npm i -g node --force resulting in my nvm v12.21.0 to point to v16.5.0 (the latest version of node at that time directly downloadable).
To solve: I ran:
Just for good measure brew uninstall nvm
brew install nvm.
nvm uninstall 12.21
nvm install 12.21
Just for good measure I ran npm i -g npm resulting in the latest version of npm installed on that virtual node.
After installing within some repo (using npm i) you may also want to check your: ~/.npmrc.
email=myemail#company.com
registry=https://artifactory.company.com/npm/npm/
always-auth=true
user-agent=npm/6.14.11 node/v12.21.0 darwin x64
_authToken=siofjwoirgiowrgnioaenrvoianeoiio32noi23nio23nio23nio
It should look something like this: (or you might not have any of that.
Had the same issue with Debian 10 (buster) when I tried installing the npm and node.js. They were incompatible and wouldn't update. This was what I found works for me.
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
The nodejs package was installed at a different path and I manually deleted the old package (in /usr/bin/) and added a symlink to point to the new one (in /usr/local/bin).
sudo rm /usr/bin/node
sudo ln -s /usr/local/node /usr/bin/node
This is the initial printouts from running the commands. The npm version updates from 5.8.0 to 8.1.2. But the nodejs version stayed at 10.24.0 even after reboot with hash -r.
None of the answers here worked. I had to delete the npm and npm-cache folders, then reinstall npm. Details here: npm does not support Node.js v12.18.3
After step 4 posted by Styx, and if node claims installation fo a newer version but npm -v keeps showing outdated version
Code for Mac and node installed with brew:
cd /usr/local/bin/
mv npm npm-backup
mv npx npx-backup
ln -s /usr/local/Cellar/node/14.2.0/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm
ln -s /usr/local/Cellar/node/14.2.0/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx
npm -version
6.14.5
I hit this issue and the steps above didn't work for me. I think it can happen if you try to upgrade Node or NPM without updating the other also. At least I think that's what happened to me.
I was trying to create a new Angular project and I had a very old version on my machine. I got an error to upgrade Node, so I bumped it to the latest version. After that I got the error running any npm command.
I resolved it simply by going to:
https://nodejs.org/en/download/
Getting the latest version and installing that in a pkg file (mac). After install was complete I was able to run everything. I'm guessing it worked because the versions of each mismatched, so one wouldn't run without the other being downgraded.
I also tried the brew option but I was getting other issues. My corporate machine sometimes blocks installations in that route, so it might work for others.
For Windows, this was driving me crazy, and all of the above solutions were not working, I would still get the old version of node showing for node -v.
For me simply killing the terminal window and starting it again resolved the issue. No amount of cache clearing worked until this. I know it sounds dumb, but that's what resolved this for me in the end. Hope this helps someone else not lose hours farting around with this.
I've have this issue in npm -v package,so you have to easy step in follow of solve this problem.
npm use stable
nvm use stable
nvm cache clear
nvm install stable --default
you can closed the terminal then check the `npm --version
Looks like a permission issue. Try with sudo

Unable to Install Ionic on Windows

I'm meant to be maintaining an Ionic app, but I cannot install Ionic on any of my machines (neither at work - Win 7) nor at home (Win 10).
Perhaps we could start with my home machine (Win 10). After the fail, I uninstalled Node completely, and restarted the machine. I re-installed Nodejs and upgraded npm such that the versions are:
Nodejs: 10.4.1
NPM: 6.1.0
The output from my Powershell prompt (at elevated privileges) is:
PS F:\Code\Powershell\Toolkit> npm install -g ionic
npm ERR! path C:\Users\roger\AppData\Roaming\npm\node_modules\ionic\node_modules.readable-stream.DELETE
npm ERR! code ENOTEMPTY
npm ERR! errno -4051
npm ERR! syscall rmdir
npm ERR! ENOTEMPTY: directory not empty, rmdir 'C:\Users\roger\AppData\Roaming\npm\node_modules\ionic\node_modules.readable-stream.DELETE'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\roger\AppData\Roaming\npm-cache_logs\2018-06-17T01_32_39_358Z-debug.log
Interestingly, the directory .readable-stream.DELETE referred to as being not empty, is empty. So, not sure what is going on there.
Any help would be great.
Thanks
First thing to do is sort out that directory deletion issue. Make sure you uninstall Nodejs to make sure none of its processes are locking that directory.
Try the following.
Right-click the drive upon which that directory is located (probably C drive).
Click Properties on the Context Menu
Go to the Tools tab
Click the Check button.
Let it run its course. Once complete, if all looks well, try deleting the directory again.
If that succeeded, install Node again (v8.11.3). Don't upgrade NPM.
Install Ionic again with npm install -g ionic
Create an app ionic start myApp tabs
Change to the myApp directory.
Run ionic serve
Hopefully the first part will clear away that folder and get you on your way.

NPM Install is not installing dependencies

I'm attempting to install the Ushahidi V3 Client. I've been following the install process up until when I need to build the project from the source repo using npm and gulp - both of which I've had zero experience with. Whenever I run sudo npm install in the project directory, the process runs without complaints. However, when I run npm ls to verify that dependencies have been downloaded, I get a bunch of dependencies listed out as being missing.
How do I get npm to resolve all of these dependencies?
System Details
OS Ubuntu 14.04 (Trusty)
Node JS v0.12.9
NPM v3.5.1
What I've tried
Removing node_modules folder and re-running sudo npm install as referenced in this SO answer for a similar question: npm Gulp dependencies missing, even after running npm install
Uninstalling and reinstalling node and npm
#Strainy, as your research :D
It was a combination of running as sudo and not having the build-essentials.
That's why you should not use sudo npm
Follow these steps:
try npm uninstall. and then try npm install.
Also If it still doesn't work.
Try:
npm install -g npm-install-missing
or
npm-install-missing
For further reading, click here.

Resources