Pyae Phyoe Shein
Pyae Phyoe Shein

Reputation: 13847

Why dependencies library version is different between package.json and npm info

I found following error when I'm rendering my nodejs project

{"level":"error","message":"uncaughtException SyntaxError: Use of const in strict mode.\n at Module._compile (module.js:439:25)\n at Object.Module._extensions..js (module.js:474:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:312:12)\n at Module.require (module.js:364:17)\n at require (module.js:380:17)\n at Object. (/var/www/myproject/dist/node_modules/sparkpost/node_modules/request/node_modules/hawk/lib/index.js:5:33)\n at Module._compile (module.js:456:26)\n at Object.Module._extensions..js (module.js:474:10)\n at Module.load (module.js:356:32)\n at Function.Module._load (module.js:312:12)\n at Module.require (module.js:364:17)\n at require (module.js:380:17)\n at Object. (/var/www/myproject/dist/node_modules/sparkpost/node_modules/request/request.js:9:12)\n at Module._compile (module.js:456:26)\n at Object.Module._extensions..js (module.js:474:10)","timestamp":"2017-09-25T02:45:43.418Z"}

That's why I check sparkpost version inside my package.json file and found "sparkpost": "^1.3.7", but when I checked with npm info sparkpost version, it goes 2.1.2

Can something help me any suggestion that how can I check actual version of sparkpost and how can I fix that error message, thanks.

Upvotes: 1

Views: 456

Answers (1)

eddies
eddies

Reputation: 7493

npm info <package_name> outputs the registry info for the latest version of <package_name> (unless you specify a version). That is, it's not going to describe your local package. npm help info explains all the gory details.

Instead, you can use npm list sparkpost to determine the version of sparkpost you have locally. Or, you can always manually inspect the locally installed version by examining the dependency's package.json with something like cat node_modules/sparkpost/package.json | grep version.

As for the actual error: you need to provide more context. You could get this if you're running a version of node < 4.0.0 without the --harmony flag. Depending on your application's requirements, you could update node or add the harmony flag to try resolving the error. Have a look at: SyntaxError: Use of const in strict mode

Upvotes: 2

Related Questions