SyntaxError: Use of const in strict mode.
Posted liziyou
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了SyntaxError: Use of const in strict mode.相关的知识,希望对你有一定的参考价值。
具体报错console
c:\Users\Administrator\WebstormProjects\blogtest\node_modules\connect-mongo\src\index.js:4 const Promise = require(‘bluebird‘); ^^^^^ SyntaxError: Use of const in strict mode. at Module._compile (module.js:439:25) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (c:\Users\Administrator\WebstormProjects\blogtest\node_modules\connect-mongo\index.js:1:80) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) at Module.load (module.js:356:32) at Function.Module._load (module.js:312:12) at Module.require (module.js:364:17) at require (module.js:380:17) at Object.<anonymous> (c:\Users\Administrator\WebstormProjects\blogtest\app.js:14:18) at Module._compile (module.js:456:26) at Object.Module._extensions..js (module.js:474:10) Process finished with exit code 8
使用了const、let、"use strict",解决方法:把connect-mongo版本降低一点,别用最新版,删除node_modules文件夹,
package.json中把connect-mongo这一条删了,换成"connect-mongo": "0.4.1"(用低版本的)
最后:npm install
以上是关于SyntaxError: Use of const in strict mode.的主要内容,如果未能解决你的问题,请参考以下文章
[tslint] Identifier 'loggedIn' is never reassigned; use 'const' instead of 'let&
[tslint] Identifier 'loggedIn' is never reassigned; use 'const' instead of 'let&
C++ error: use of deleted function ‘std::atomic<short unsigned int>::atomic(const std::atomic<short
SyntaxError: Unexpected token 'const' -- 尽管我替换了 const
SyntaxError: Unexpected token 'const' (with Vue, Karma, Webpack, PhantomJS)