[英]Upgrade the version of nodejs to 5.12.0
I tried to install node.js by NVM in Ubuntu 16.04 server by following this link .我尝试通过此链接在 Ubuntu 16.04 服务器中通过NVM安装 node.js。 And I got:我得到了:
root@instance-15s8fbzx:/opt# nodejs --version
v4.2.6
root@instance-15s8fbzx:/opt# npm --version
5.3.0
root@instance-15s8fbzx:/opt# node --version
v8.4.0
Then, we I run a mean-stack project by sudo npm start
, I got然后,我们通过sudo npm start
运行一个 mean-stack 项目,我得到了
class User {
^^^^^
SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
Then, I saw this link , I think maybe because the nodejs version is not correct.然后,我看到了这个链接,我想可能是因为 nodejs 版本不正确。 I have another server with v5.12.0
as the version of nodejs
, and the project worked well there.我有另一台服务器v5.12.0
作为nodejs
的版本,并且该项目在那里运行良好。
Then, I tried to do然后,我试着做
sudo npm install -g npm
sudo npm install -g n
sudo n stable
sudo ln -sf /usr/local/n/versions/node/8.4.0/bin/node /usr/bin/node
But the version of the nodejs is still 4.2.6
.但是nodejs的版本还是4.2.6
。 Does anyone know how to upgrade its version to 5.12.0
?有谁知道如何将其版本升级到5.12.0
?
在安装NVM并安装了必需的节点版本之后,请按如下所示选择节点版本:
> nvm use v5.12.0
After upgrading to the Nodejs version, the following error occurred for the Laravel and VUE js packages I already had:
PHP Fatal error: During inheritance of IteratorAggregate: Uncaught ErrorException: Return type of Symfony\Component\HttpFoundation\ParameterBag::getIterator() should either be compatible with IteratorAggregate::getIterator(): Traversable, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice in C:\xampp\htdocs\clerk\vendor\symfony\http-foundation\ParameterBag.php:210 PHP 致命错误:在 IteratorAggregate 的 inheritance 期间:未捕获的错误异常:Symfony\Component\HttpFoundation\ParameterBag::getIterator() 的返回类型应该与 IteratorAggregate::getIterator(): Traversable 兼容,或者 #[\ReturnTypeWillChange] 属性应该用于临时抑制C中的通知:\xampp\htdocs\clerk\vendor\symfony\http-foundation\ParameterBag.php:210
To solve the issue, I did the following:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.