Run Laravel Mix without a global nodejs and npm installation

Viewed 14

I have a laravel project and I need to build styles and scripts with laravel-mix, but a testing server (Ubuntu 20.04.4) hasn't a globally installed node. Node and npm are in different folders in the system so I run commands like this:

/path/to/node /path/to/npm install
/path/to/node /path/to/npm run dev

But when I run npm run dev (this command runs laravel-mix build), I see the error:

> mazer@2.0.0 dev
> mix

/usr/bin/env: ‘node’: No such file or directory

In the package.json it looks like this:

"scripts": {
    "dev": "mix"
    ...
}

I checked the laravel-mix package (in node_modules) and found this: #!/usr/bin/env node. The package checks the node var in this file, but there is no node var.

I don't need to change the env file, so how can I change this path or set a temporary system var? Is there any way to simulate that the variable is there?

0 Answers
Related