Node.js installed via NVM on Linux throwing Permission denied - node.js

I've installed node.js using NVM and it has created the relevant folders, suggests that it is running fine on v0.10.38, but when I type in node to run, I get bash: /home/example.com/.nvm/v0.10.38/bin/node: Permission denied
Any ideas what is stopping it?

Related

`npm run` giving permission denied

I've started facing an issue today which was not occurring before and no code has been changed on my end.
I'm using Laravel 8 with Laravel Mix and when I run npm run prod I keep getting the following:
> prod
> npm run production
> production
> mix --production
/tmp/production65665869399.sh: 2: mix: Permission denied
Do you have any idea?
I even tried making /tmp directory to have 777 permission and tried to change the owner to be the user I'm logged in as but still the same issue.
It's started all of a sudden and there is no resource about it in the internet.
I'm using Node version 14.15.0 and npm version 8.13.2
This error doesn't occur on my local environment but on AWS Ubuntu server.
Tried to uninstall your node js, and just reinstall it using NVM. Make sure you are not running as root user while installing, hopefully this link can help you:
https://www.digitalocean.com/community/tutorials/how-to-install-node-js-on-ubuntu-18-04

cant run electron on win10 ubuntu subsystem

i have a repo for an electron project ive been able to run in ubuntu subsystem before fine, im on a new pc now and having trouble. I already ran npm i, but when I run electron . i get this err:
martin#DESKTOP-URPCCBK:/mnt/c/Users/marti/Documents/projects/electron-upload-manager$ npm start
> drag-and-drop#1.0.0 start /mnt/c/Users/marti/Documents/projects/electron-upload-manager
> electron .
[5094:0907/143024.016724:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
so i ran
sudo chown root /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox
and
sudo chmod 4755 /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox
then ran npm start again, and get:
martin#DESKTOP-URPCCBK:/mnt/c/Users/marti/Documents/projects/electron-upload-manager$ npm start
> drag-and-drop#1.0.0 start /mnt/c/Users/marti/Documents/projects/electron-upload-manager
> electron .
[5120:0907/143308.127280:FATAL:setuid_sandbox_host.cc(158)] The SUID sandbox helper binary was found, but is not configured correctly. Rather than run without sandboxing I'm aborting now. You need to make sure that /mnt/c/Users/marti/Documents/projects/electron-upload-manager/node_modules/electron/dist/chrome-sandbox is owned by root and has mode 4755.
I did what the error asked, but still got the error? Ive tried removing my node_modules, reinstalling with npm i, running apt-get update, installing electron globally but still am getting this err
You need to enable metadata on DrvFs. Put this in /etc/wsl.conf:
[automount]
options = "metadata"
After this, chmod/chown should work on windows files. See this Microsoft blogpost for more details.
Try this command. It is a work-around:
sudo sysctl kernel.unprivileged_userns_clone=1
ill just run it in command prompt instead, got it working fine there

Fail to install SASS using NPM

Error
I'm trying to install SASS on my machine using NPM, but I'm getting an error
You need to run the console as sudo (i see you are using LINUX or MAC), which are both UNIX-based systems or Run as administrator in windows.
If you take a look at the error you are getting it says permission denied and that you should try to run that as administrator/root.

Error: EACCES: permission denied NPM Ubuntu Server

I am running an Ubuntu EC2 server and followed the tutorial provided by AWS to install nvm and node, but when I try to run npm install, I'm thrown an error:
Error: EACCES: permission denied, access '/var/www/app'
Please try running this command again as root/Administrator.
The standard procedure with an EC2 Ubuntu service appears to only provide a ubuntu user with sudo privileges and no access to root so I tried to run sudo npm install, but I receive sudo: npm: command not found. The reason why I believe this is happening is because nvm is located at /home/ubuntu/.nvm/versions/node/v6.12.3/bin/node, which root might not have access to?
Is it possible to point root to the this directory location for this command or is there a different solution?
You're getting that error because you do not have write permission for your user on that /var/www/app.
You can follow the answer here to give permissions to that folder.
https://askubuntu.com/questions/749697/how-do-i-give-myself-access-to-var-www-to-create-and-edit-files-and-folders-in
You are getting the error about npm not being installed when you use sudo because it is not installed for the admin user. I would avoid installing node and npm through sudo though. Just go with changing the folder permissions.

Node module missing error when script tries to restart

I am running CentOS Linux release 7.1.1503 (Core) and I frequently run into a problem of missing node modules.
Here are some paths I printed on the console:
which npm
/root/.nvm/versions/node/v8.2.1/bin/npm
which node
/root/.nvm/versions/node/v8.2.1/bin/node
which forever
/usr/local/bin/forever
Now, when I start the script with forever it runs. Sometimes in the midnight, when I just verify if all the scripts are running, many are failing and the error is something like:
I have to go and install the node module. What could possibly be the reason for this? Could it be some permission issue?
Check if you have fs-extra installed at the directory you working or globally (if not - just run npm install fs-extra)
If you are going to work with AWS.S3 - check credentials permissions (for example aws s3 ls - you should see list of available buckets)

Resources