在centos上安装带有sequelize的nodejs时出错

Error when install nodejs with sequelize on centos

这是我的nodejs版本:6.17.1和sequelize 6.4.0。我遵循这个:https://bezkoder.com/react-node-express-mysql/。我得到了错误:

> /app/nodejs/node_modules/sequelize/lib/sequelize.js:277
>       ...options

> SyntaxError: Unexpected token ...
>     at createScript (vm.js:56:10)
>     at Object.runInThisContext (vm.js:97:10)
>     at Module._compile (module.js:549:28)
>     at Object.Module._extensions..js (module.js:586:10)
>     at Module.load (module.js:494:32)
>     at tryModuleLoad (module.js:453:12)
>     at Function.Module._load (module.js:445:3)
>     at Module.require (module.js:504:17)
>     at require (internal/module.js:20:19)
>     at Object.<anonymous> (/app/nodejs/node_modules/sequelize/index.js:8:18)

我是不是错了什么?

使用此代码解决:

+ sudo yum install nodejs
+ node --version
+ npm --version
+ which node
+ which npm
+ curl -sL https://rpm.nodesource.com/setup_12.x | bash -
+ ls -la /etc/yum.repos.d/|grep nodesource
+ sudo yum remove -y nodejs npm
+ sudo yum list available nodejs
+ sudo yum install nodejs
+ node --version
+ npm --version

来源:https://matthiashoys.wordpress.com/2020/01/15/how-to-upgrade-node-js-from-v6-to-v12-on-centos-linux-7/

您的节点版本不支持展开运算符 (...)。您需要8.6以上的版本。

关注此link,了解节点中的具体支持方法,https://node.green/#ES2015