V5 fresh install npm and node not found

OS: CentOS 8

installed v5 following the @TechnicallyComputers guide.
Installation wasn’t smooth and the guide is missing some crucial steps, like php artisan key:generate and chmodding some folders etc.
But I managed to get to the point where I finally can see the setup page. And this is where I am stuck: InvoiceNinja does not see node and npm despite those being installed.
I assume the problem is:

[root@server02 invoiceninja]# npm root -g
/root/.nvm/versions/node/v14.6.0/lib/node_modules

but this is how it installed using the NVM.

The Laravel debug tells:

[11:40:37] LOG.info: The command "PATH=$PATH:/usr/local/bin NODE_PATH=`npm root -g` node '/usr/share/nginx/invoiceninja/vendor/spatie/browsershot/src/../bin/browser.js' '{"url":"file:\/\/\/tmp\/209706731-0069307001595850037\/index.html","action":"pdf","options":{"path":"\/usr\/share\/nginx\/invoiceninja\/public\/test.pdf","args":[],"viewport":{"width":800,"height":600},"displayHeaderFooter":false}}'" failed.

Exit Code: 127(Command not found)

Working directory: /usr/share/nginx/invoiceninja/public

Output:
================


Error Output:
================
sh: npm: command not found
sh: node: command not found

What am I missing here?

It looks like it possible to manually set the paths, you may want to try setting NODE_PATH and NPM_PATH in the .env file and then clear the cache by running php artisan config:clear

I have set those variables in .env file

NODE_PATH = /root/.nvm/versions/node/v14.6.0/bin/node
NPM_PATH = /root/.nvm/versions/node/v14.6.0/bin/npm

and issued php artisan config:clear as requested.
Setup page still complains about them missing.

One consideration, I can see you are locating the node/npm packages using root, these may not be resolvable by the webserver user.

following the given instructions, this is where those packages got installed.
Is there really any advantage in installing those via Node Version Manager (given the fact that InvoiceNinja is the only thing running on that server) rather that simply via yum?

I ended up installing node via yum and that satisfied the setup checks

1 Like

Thank you, I will try to review and repost my guide with changes like not using version managers for anything, since they add extra complication, and the missed php artisan key:generate and generally review my steps more closely

1 Like

@TechnicallyComputers I think that would be very desirable - I’d hazard a guess that vast majority of users won’t even need multiple versions of Node on their servers (as they might - like I did - just be using a small VPS that is dedicated for InvoiceNInja), so using NVM would make no sense.

If I may suggest / request something: try to aim that guide towards a fresh installation - that way people who had just spun up a new VPS will have all the tools and commands to make the InvoiceNinja work and the people who already have a CentOS running (probably with half of the packages already present) will just see that some packages are already installed.