connect-redis: SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode

Hello.

I’ve installed the last version - 3.4.0 - and it’s giving me the following error:

/Users/user/dir/project/node_modules/connect-redis/node_modules/debug/src/node.js:132
	let val = process.env[key];
	^^^

SyntaxError: Block-scoped declarations (let, const, function, class) not yet supported outside strict mode
    at exports.runInThisContext (vm.js:53:16)
    at Module._compile (module.js:373:25)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/user/dir/project/node_modules/connect-redis/node_modules/debug/src/index.js:9:19)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/user/dir/project/node_modules/connect-redis/lib/connect-redis.js:7:13)
    at Module._compile (module.js:409:26)
    at Object.Module._extensions..js (module.js:416:10)
    at Module.load (module.js:343:32)
    at Function.Module._load (module.js:300:12)
    at Module.require (module.js:353:17)
    at require (internal/module.js:12:17)
    at Object.<anonymous> (/Users/user/dir/project/node_modules/connect-redis/index.js:1:80)

What I’ve done for now was a downgrade to at least 3.2.0 to get it resolved.

About this issue

  • Original URL
  • State: closed
  • Created 6 years ago
  • Comments: 16 (6 by maintainers)

Most upvoted comments

Inside your main app .js file, where you have require('connect-redis')() put use strict at the very top, the first line of code.

I updated node to v11.6.0

Latest version of node is currently 12.1.0

nvm install 12.1.0
nvm use 12.1.0
nvm alias default 12.1.0

Inside your code, where you have require(‘connect-redis’)(), insert this as the first line of code… use strict

@knoxcard @wavded I started a project from scratch just to make sure and it’s working fine, so I think the problem is related to the project I was working on before. Sorry for any inconvenience and thank you for your support.

@knoxcard thnx for help,finally i run cryptonote with nodejs