DEV Community

Discussion on: how to resume multiple commands on one command

Collapse
 
qm3ster profile image
Mihail Malo

Since you clearly have npm and this is happening in a directory with a package.json, I recommend familiarizing yourself with npm-run-all(run-s, run-p), or equivalent, then you won't be tied to bash (can run on windows without bash installed, for example).

Also, there's pretty much no reason any of these commands should require sudo, and especially the npm ones are wildly unsafe. update can run arbitrary installation lifecycle scripts from unknown parties, and run well... runs the actual code of the dependencies in accordance with how your scripts call it. If this doesn't work without sudo in your case, you should probably fix the file permissions instead of giving superuser access to these already insecure tools.

Finally, you said "every time when I pull from the repository". These is a small chance you might be interested in git hooks, eg through git-hooks-js or husky

Collapse
 
mostafalaravel profile image
mostafalaravel

Thanks Mihail Malo

Collapse
 
mostafalaravel profile image
mostafalaravel

when I run npm update I got this error :


npm ERR! code EACCES
npm ERR! syscall unlink
npm ERR! path /home/helloworld/.npm/_logs/2020-11-25T10_30_33_060Z-debug.log
npm ERR! errno -13
npm ERR!
npm ERR! Your cache folder contains root-owned files, due to a bug in
npm ERR! previous versions of npm which has since been addressed.
npm ERR!
npm ERR! To permanently fix this problem, please run:
npm ERR!   sudo chown -R 1001:1001 "/home/mabdellaoui/.npm"
npm ERR! code EACCES
npm ERR! syscall open
npm ERR! path /home/mabdellaoui/.npm/_cacache/tmp/7beab320
npm ERR! errno -13

Enter fullscreen mode Exit fullscreen mode


`

Thread Thread
 
qm3ster profile image
Mihail Malo

Wow, what an amazing error!
Good job, npm developers!
It tells you WHY this happened, and also tells you the correct way to fix it!

Collapse
 
moopet profile image
Ben Sinclair

It's also very unlikely you want to run git pull every time you pull, because that would never end...

Collapse
 
qm3ster profile image
Mihail Malo

lmao