简体   繁体   English

Laravel命令输出的节点版本与命令行不同

[英]Laravel Command outputs different version of node than command line

I upgraded my node to v10.16.0 on a server containing a running Laravel instance. 我在包含正在运行的Laravel实例的服务器上将节点升级到v10.16.0。

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: 这是手动运行Laravel计划命令并回显响应的结果:

$ php artisan custom:command
v10.16.0

This is the output when that command is run by Laravel on it's 5 minute schedule: 这是Laravel在5分钟的时间表上运行该命令时的输出:

v6.14.3

Laravel command is as follows: Laravel命令如下:

$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. 当然,Laravel只是以与您使用exec()相同的方式在命令行上运行命令,因此应该使用相同的版本。 Even php artisan seems to get the right version. 甚至php artisan似乎都能获得正确的版本。

  1. Restart the server 重新启动服务器
  2. Make sure that you've removed the older version of node and you only have v10 确保已删除旧版本的节点,并且只有v10

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM