首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >节点js表示验证程序抛出错误

节点js表示验证程序抛出错误
EN

Stack Overflow用户
提问于 2018-06-04 08:29:02
回答 2查看 483关注 0票数 0

我已经安装了速成验证器,但是抛出了如下错误:

快递-验证器@5.2.0

购物车@0.0.0开始/var/www/nodejs/购物车节点。/bin/www

代码语言:javascript
复制
/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
EN

回答 2

Stack Overflow用户

发布于 2018-06-04 08:31:45

此语法来自ES6,节点版本4不支持该语法。请更新推荐的node.js版本,因为节点4的维护期已经结束。

票数 0
EN

Stack Overflow用户

发布于 2018-06-04 08:33:35

对象析构语法来自ES6/ECMAScript 2015。

最新版本的Node.js 6.x支持93%的ES6特性。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/50676297

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档