Error to install PM2 globally on Ubuntu Server 20.04LTS - node.js

I have a VM running Ubuntu Server 20.04LTS and I want to run a nodejs program using PM2. I'm having problems to install pm2 npm install -g pm2#latest and sudo npm install -g pm2#latest.
npm ERR! code ENOENT
npm ERR! syscall chmod
npm ERR! path /usr/lib/node_modules/pm2/node_modules/mocha/node_modules/mkdirp/bin/cmd.js
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, chmod '/usr/lib/node_modules/pm2/node_modules/mocha/node_modules/mkdirp/bin/cmd.js'
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! /root/.npm/_logs/2020-06-04T18_01_48_656Z-debug.log
Ps: I tried npm install -g npm#latest and cleaning npm cache but nothing seems to work. The error says that this file doesn't exist but despite knowing that, I don't know what I can do or what is causing the problem. I don't know if this affects something but I'm on root mode

The author of pm2-web deprecated it a while ago, so it might be uninstallable any more.
from the official github readme:
Since it's no longer possible to monitor pm2 running on multiple
machines I'm not really working on pm2-web any more.
For an alternative, check out Guvnor - a process manager with support
for multiple hosts, unix based permissions, a far more capable web
interface and more.
Guvnor too wasn't easily installable on ubuntu 20.04, right now I use pm2.io or pm2-gui to control my instances via web interface.

Related

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 not working on Virtualbox shared folder under Ubuntu on a Windows 10 host

I'm trying to set-up a development environment on a Virtualbox machine using Vagrant. I'm using Windows 10 as a host machine, and ubuntu/bionic64 as a guest machine.
My package.json file is located under a shared directory between the host machine and the guest machine. However whenever I run npm install --no-bin-links I do get the following error:
npm ERR! code ENOENT
npm ERR! syscall open
npm ERR! path /home/vagrant/www/wp-content/plugins/my-plugin/node_modules/array-initial/node_modules/is-number/package.json.1640612897
npm ERR! errno -2
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/www/wp-content/plugins/my-plugin/node_modules/array-initial/node_modules/is-number
/package.json.1640612897'
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/vagrant/.npm/_logs/2021-01-19T05_31_47_272Z-debug.log
Inside the guest machine, if I copy the package.json and package-lock.json into another directory that is not shared, and then run npm install everything works perfectly.
mkdir /tmp/test/
cp package.json package-lock.json /tmp/test/
cd /tmp/test/ && npm install
# NPM Packages are installed successfully!
I think this error is specific to Windows, as I've been a user of Ubuntu for years, and never had a similar issue. I only started using Windows a week ago.
The strange thing is, I also have another development environment on the same machine, and NPM works just fine, without any issues on shared folders!
I used the --no-bin-links, so I don't think the issue has anything to do with the symbolic links.
Looking into the strace output, I can't see when this file node_modules/array-initial/node_modules/is-number /package.json.1640612897 was created.
NPM log
Strace log

in laravel homstead project npm install get error

My operating system is windows 10. I'm using laravel homestead (ubuntu 18.04) resent release and working in a virtual box with vagrant. After installing Laravel when I try to run:
composer require laravel/breeze --dev
to get the Authenticate part it works fine. after that, it says to run npm install && npm run dev
Then I CD to my test.com project and ran that command
after install, some features below error appears.
(I get the same issue when I try to require jetstream )
I used my Git bash shell as admin. I did re-run npm, npm clear cash force, remove package.json but still having the same problem.
sudo npm install says some permission problem in the host computer.
Actually, I'm Stuck. Please help
npm ERR! code ENOENT<br>
npm ERR! syscall open<br>
npm ERR! path /home/vagrant/code/test.com/node_modules/yargs/node_modules/yargs-parser/
package.json.1050278784
npm ERR! errno -2<br>
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/code/test.com/no
de_modules/yargs/node_modules/yargs-parser/package.json.1050278784'<br>
npm ERR! enoent This is related to npm not being able to find a file.<br>
npm ERR! enoent<br>
npm ERR! A complete log of this run can be found in:<br>
npm ERR! /home/vagrant/.npm/_logs/2020-12-20T04_04_37_652Z-debug.log<br>
vagrant#homestead:~/code/test.com$ cd /

Can't install clean-webpack-plugin for nodejs

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

"Permission Denied" in Node on Linux, when running start-script /w local nodemon/mocha/babel-node

I'm having issues with my new linux setup - I've installed nodemon as a local dependency (NOT globally) and I'm trying to execute it from my package.json "start"-script. I'm getting this permission error.
node by itself works great, but as soon as I try to use babel-node or nodemon or even mocha, I get permission problems.
My setup is divided across 2 hard drives - node is installed on my SSD (with my OS), and my project (and it's node_modules, where I'm trying to execute nodemon from is on my storage-HDD.
sh: 1: nodemon: Permission denied
npm ERR! Linux 3.19.0-56-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! node v5.9.0
npm ERR! npm v3.7.3
npm ERR! code ELIFECYCLE
npm ERR! vyggo-easyrtc#1.0.0 start: `nodemon --exec node entry`
npm ERR! Exit status 126
npm ERR!
npm ERR! Failed at the vyggo-easyrtc#1.0.0 start script 'nodemon --exec node entry'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the vyggo-easyrtc package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! nodemon --exec node entry
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs vyggo-easyrtc
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls vyggo-easyrtc
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /media/goatic/HDD/Projects/Node/vyggo-easyrtc/npm-debug.log
goatic#goatic-laptop:/media/goatic/HDD/Projects/Node/vyggo-easyrtc$
I had this problem after changing moving my project from an NTFS filesystem to linux. I changed all the file/directory permissions to 644/755 and also set the owner/group. That's when I started getting this error.
When I tried nodemon in the terminal, I got command not found. Strange.
Reinstalling nodemon fixed it:
sudo npm install -g nodemon
My secondary drive was incompatible with my linux OS in terms of permissions, as it was an NTFS partition.
I ended up moving everything to my primary drive, and of course permissions were working again, allowing me to execute local dependencies.
I guess the solution to my problem, had I relied on keeping projects on the secondary drive, would be to format it to a format compatible with Linux permissions.
If you are installing in MAC Use.
sudo npm install -g nodemon --unsafe-perm.
It will work.
I had the same problem. In my case when I changed my operating system to Linux Ubuntu, 20.04.1 Version, reinstalling nodemon solved the problem.
For Linux users:
sudo npm install -g nodemon
for Windows users, open a new terminal or cmd prompt just write:
npm install -g nodemon
For more information check nodemon documentation:
nodemon documentation
I counter this problem when I git clone a project which initially created on a Windows machine, my simple solution is to delete the .node_modules directory and then run npm install, which solved my problem.
very weird, I had the same problem except I solved it by replacing Nodemon devStart with nodemon devStart and suddenly the error was gone :)

Resources