/tmp permission denied while trying to run `npm run build` on linux - linux

I've laravel application deployed to Linux/Debian server, one of the steps that I have to do is to run npm run build for production
I got the following error:
npm run build
> build
> vite build
/tmp/build-ade1100b.sh: 1: vite: Permission denied
I tried to do this with sudo privilege, another user has sudo privilege too, it didn't work, I know this is a sticky folder, I tries too many solutions but no one work with me.
Any help please?

Delete your node_modules folder using rm -rf node_modules/
Reinstall the modules using npm i or yarn install
npm run build should now work again.

Related

Create vue Permission denied

I'm trying to install vue app using this command "npm init vue#latest",
But the following error occurred with me, any help :(
Note : I tried many solutions like : chmod -R 755 .npm and sudo chown -R mostafa .npm but nothing changes
maybe you could try using the vue-cli like this:
npm install -g #vue/cli && vue create hello-world
If this wouldn't work then I'd suggest to reinstall node/npm
You should probably also make a clean installation of these tools so that you don't need to run such things as administrator
In order to install vue on your machine you must first have installed nodejs ( package manager node package manager ) to which the acronym npm refers, I leave you the linux commands under :
install :
sudo apt install nodejs
shows the installed version of nodejs :
node -v
After installing nodejs try relaunching the command to install vue
if you have already installed them try with this :
add write permissions to the study folder , and not to the mostafa folder , linux only assigns permissions to the folder in the chmod command and not subfolders, try these commands :
cd home/mostafa/Dowloads
sudo chmod ugo+w study
Are you not being blocked by SELinux directives?
Try running the same command using your least privileged user (normal user).
And please avoid using the root user for everyday tasks.
You need to have installed Nodejs, vue and create-vue.
sudo apt install nodejs
npm install vue#latest
npm install create-vue#latest
Now you can run the command to start the new project with Vue.
npm init vue#latest

Permission denied when running npm start

I'm trying to run a node and react js project that i got from someone else and this is the error that i get.
Can someone please help me fix this?
cd frontend
npm start
> frontend#0.1.0 start
> react-scripts start
sh: /Users/..../...../...../frontend/node_modules/.bin/react-scripts: Permission denied
.... frontend %
Just run the command below in project root. You might installed it globally.
npm install react-scripts --save
You don't have required permissions in the given directory.
You can run
sudo npm start
or update permissions for the directory
sudo chmod 777 -R Your_Dir/
Try to remove node_modules folder and package-lock.json
sudo rm -rf node_modules
sudo rm package-lock.json
npm install

'npm EER! code 1' When installing dependencies using `npm install --production`

I am using flightplan to deploy my node.js application to my server. I run the command fly production in my CLI to deploy my app to the server. It does rsync fine, but when it comes to installing dependencies, I get the following error:
I made sure that I have sudo privileges on my server for this user and npm is definitely installed as it gives the version number when I run the command npm -von my server. I have tried to run npm install --production myself on the server as the deploy script does and I get the same error, meaning it is something to do with installing dependencies. Potentially, it could be because in my flightplan.js, when it runs the command git ls-files to get the files to copy across. it includes all the node_modules even though i've made sure that node_modules is in the .gitingore file.
Does anyone have experience with flightplan npm module/or know why my npm install isn't working on my server?
(I edited out my server IP address from the picture)
Thanks in advance!
I found that if I removed the node_modules folder by running command rm -rf node_modules/ then committed this to github, then re-ran npm install and then my call to fly production worked successfully.

npm install resulting in 'ENOENT: no such file or directory'

I've installed Node.js for Windows and I'm trying to install a package via npm. The command prompt is in the directory of the project (C:\Users\username\Desktop\NodeTest), which contains a single helloworld.js file. Upon typing 'npm install express', I receive the following error:
ENOENT: no such file or direcotry, open 'C:\Users\username\package.json
I'm attempting this from a clean install and cmd is running as admin.
Any ideas?
I was facing the same issue. I firstly delete my node_modules and delete the cache by following command:
rm -rf node_modules && npm cache clean --force
then I delete the package-lock.json file from my project and then hit npm install in command prompt and it works.
As already pointed out by Subburaj this is because you are missing a package.json.
Just run npm init to initialize that file for you; afterwards it should work.
If you are working on a Windows machine using Vagrant/VM, there's a chance that symlinks are the culprit for your problem. To determine if that is the case, simply copy your package.json and package-lock.json into a test directory that is not mounted/shared between OSs.
mkdir /tmp/symlinktest
cd {{your directory with your package*.json}}
cp package*.json /tmp/symlinktest
cd /tmp/symlinktest
npm install
If this results in a successful install, you'll need to either exclude the node_modules directory from the mount (there's various articles on doing this, however I can't say I've had success) or run npm install outside the mounted volume.
I deleted the package-lock.json and It worked for me.
Basically I was Offline while I tried to install with npm, so go online and try
npm install again
Check the project folder which you opened in microsoft visual code. Generally you are not in the right path so npm is not able to search the package.json ... My project was in Document/hostel/hostel .. I opened Document/hostel ... So npm tried to find the package.json in Documents folder .. When i entered one level inside to Document/hostel/hostel .. it was fixed.

NodeJS- Cannot install nodemon

I am trying to install nodemon but everytime I got stuck at the same part.
It get a response, but didn't end the job.
I have to stop it after some minutes with the state bellow.
I already try another modules and all of them install correctaly.
Could someone say what could be wrong or any other similar module?
Thanks.
Your environment has been set up for using Node.js 0.10.28 (x64) and npm.
C:\Users\>npm instal -g nodemon
npm http GET https://registry.npmjs.org/nodemon
npm http 304 https://registry.npmjs.org/nodemon
This has happened to me with other modules after canceling the install mid-way once, then when I do it again, it will get stuck.
I had to clear the cache before trying again.
npm cache clean
npm install -g nodemon
I've made it but I installed from the source and I did a git clone from the master branch, so try this out:
Create a folder:
mkdir nodemon
cd nodemon
clone the repo:
git clone https://github.com/remy/nodemon.git
then do an install in the folder you have created
npm install
Type nodemon just to make sure you have installed it.
in the case you got an erorr like this
Error: EACCES, permission denied '/home/[username]/.config/configstore/update-notifier-nodemon.yml'
You don't have access to this file.
try this
sudo chown [username]:[username] /home/[username]/.config/configstore/ -R

Resources