繁体   English   中英

在 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以上的版本。

点击这个链接,在node中找到具体的支持方法, https://node.green/#ES2015

暂无
暂无

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

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