我已经安装了速成验证器,但是抛出了如下错误:
快递-验证器@5.2.0
购物车@0.0.0开始/var/www/nodejs/购物车节点。/bin/www
/var/www/nodejs/shopping-cart/node_modules/express-validator/lib/express_validator.js:4
const { checkSchema, validationResult } = require('../check');
^
SyntaxError: Unexpected token {
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:374:25)
at Object.Module._extensions..js (module.js:417:10)
at Module.load (module.js:344:32)
at Function.Module._load (module.js:301:12)
at Module.require (module.js:354:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/var/www/nodejs/shopping-cart/node_modules/express-validator/index.js:1:80)
at Module._compile (module.js:410:26)
at Object.Module._extensions..js (module.js:417:10)
npm ERR! Linux 4.13.0-43-generic
npm ERR! argv "/usr/bin/nodejs" "/usr/local/bin/npm" "start"
npm ERR! node v4.2.6
npm ERR! npm v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! shopping-cart@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the shopping-cart@0.0.0 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the shopping-cart package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs shopping-cart
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls shopping-cart
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! /var/www/nodejs/shopping-cart/npm-debug.log发布于 2018-06-04 08:31:45
此语法来自ES6,节点版本4不支持该语法。请更新推荐的node.js版本,因为节点4的维护期已经结束。
发布于 2018-06-04 08:33:35
对象析构语法来自ES6/ECMAScript 2015。
最新版本的Node.js 6.x支持93%的ES6特性。
https://stackoverflow.com/questions/50676297
复制相似问题