NPM clean-install in public folder - command not found
-
As I understand it npm should be installed and usuable in the LAMP app, bit every time i try to execute the command
npm clean-installas the www-data user in the public directory I get the error npm: command not found. I've seen a few tips here in the forum relating to problems with npm but nothing that solves this.
-
Use the full path to it as it is probably just not in the $PATH var for www-data:
/usr/local/node-18.18.0/bin/npm <args> -
@murgero Thank you. Unfortunately it still doesn't work. Now getting
/usr/bin/env: ‘node’: No such file or directoryas a response.
@ccfu oh ok so node is also not in the path for www-data. Try this instead:
-
Add the Node binaries to PATH:
- Run command:
PATH=$PATH:/usr/local/node-18.18.0/bin/
- Run command:
-
Now run npm or node:
- Run command:
npm clean-install
- Run command:
Note - you will need to run that PATH command everytime you reset the www-data session (so whenever you login/logout to the terminal or via ssh / etc)
-
-
@ccfu oh ok so node is also not in the path for www-data. Try this instead:
-
Add the Node binaries to PATH:
- Run command:
PATH=$PATH:/usr/local/node-18.18.0/bin/
- Run command:
-
Now run npm or node:
- Run command:
npm clean-install
- Run command:
Note - you will need to run that PATH command everytime you reset the www-data session (so whenever you login/logout to the terminal or via ssh / etc)
-
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login