1

I upgraded my node to v10.16.0 on a server containing a running Laravel instance.

This is the output after upgrade:

$ node -v
v10.16.0

This is the ouptut from running the Laravel scheduled command manually and echo-ing the response:

$ php artisan custom:command
v10.16.0

This is the output when that command is run by Laravel on it's 5 minute schedule:

v6.14.3

Laravel command is as follows:

$process = new Process("node -v");
$process->run();

How is this possible? Surely Laravel just runs a command on the command line in the same way you'd use exec() and thus should be on the same version. Even php artisan seems to get the right version.

simonw16
  • 960
  • 9
  • 25
  • does output of `which node` differ when run from bash and laravel thingy? – oguz ismail May 29 '19 at 23:13
  • Interesting. `which node` from bash is `/usr/local/bin/node` and from laravel is `usr/bin/node`. So that means the node version is updated just for this user? How do I update it across all users if the standard `sudo npm install -g n` `sudo n stable` trick doesn't work? – simonw16 May 29 '19 at 23:31
  • idk, pip does that sometimes too. that's why i don't use both – oguz ismail May 29 '19 at 23:57
  • Yea I can see that problem. Honestly I thought the module `n` would upgrade rather than just install another version side by side. I have opted to entirely remove node as found here: https://stackoverflow.com/questions/11177954/how-do-i-completely-uninstall-node-js-and-reinstall-from-beginning-mac-os-x . Then re-install using nvm. I hope it works. – simonw16 May 30 '19 at 00:14
  • Okay so that didn;t work either. I can `sudo su -s /bin/bash my-user` to the many different users. www-data in particular, and they all have access to node. and yet Laravel STILL doesn't recognise node. (now that I've deleted and re-installed) – simonw16 May 30 '19 at 00:55

1 Answers1

-1
  1. Restart the server
  2. Make sure that you've removed the older version of node and you only have v10
CodeJunkie
  • 339
  • 3
  • 16
  • Exactly my thoughts. It doesn't require a server restart. However removing older versions of node leads me to check if the other version is present, and where it is if so. Not sure how I'd check that though. – simonw16 May 29 '19 at 23:07