I'm using below package.json
in my node project and when i run
npm test
, it gives the below error
Module version mismatch. Expected 48, got 51
{
"name": "f-api",
"version": "0.0.1",
"Description": "F",
"author": "F",
"private": true,
"scripts": {
"start": "node ./bin/www",
"start_supervise": "supervisor ./bin/www",
"test": "mocha --recursive --timeout 10000"
},
"dependencies": {
"bcrypt": "=1.0.2",
"body-parser": "~1.13.2",
"config": "^1.24.0",
"cookie-parser": "~1.3.5",
"debug": "~2.2.0",
"express": "~4.13.1",
"jwt-simple": "^0.5.1",
"moment": "^2.17.1",
"morgan": "~1.6.1",
"nodemailer": "=2.7.2",
"nodemailer-smtp-transport": "^2.7.2",
"pg-promise": "^3.2.3",
"sequelize": "^3.29.0",
"sequelize-cli": "^2.1.0",
"supervisor": "^0.12.0"
},
"devDependencies": {
"chai": "^3.5.0",
"chai-http": "^3.0.0",
"mocha": "^3.2.0",
"nodemailer-stub": "^1.0.1",
"should": "^11.1.2",
"supertest": "^2.0.1"
}
}
I think it's some incompatibility of versions, i'm bit new to node, npm
and versions syntax like ^, ~, =
I get the following out put in gitlab runner, docker executor
Running with gitlab-ci-multi-runner 1.11.1 (a67a225)
on gitlab-runner-b-ubuntuvm (1ffe18b1)
Using Docker executor with image node:6.10.0 ...
Starting service postgres:latest ...
Pulling docker image postgres:latest ...
Waiting for services to be up and running...
Pulling docker image node:6.10.0 ...
Running on runner-1ffe18b1-project-6-concurrent-0 via ubuntu...
Cloning repository...
Cloning into '/builds/f/f-api'...
Checking out bcf3e283 as development...
Skipping Git submodules setup
Downloading artifacts for build:linux (495)...
Downloading artifacts from coordinator... ok id=495 responseStatus=200 OK token=hXK-foh8
Checking cache for test:linux/development...
Successfully extracted cache
$ ./node_modules/.bin/sequelize db:migrate --env=continuous_integration
Sequelize [Node: 6.10.0, CLI: 2.5.1, ORM: 3.30.2]
Loaded configuration file "config_tmp.json".
== 20170120101655-createUserTable: migrating =======
== 20170120101655-createUserTable: migrated (0.031s)
== 20170120111051-addPasswordDigestToUsers: migrating =======
== 20170120111051-addPasswordDigestToUsers: migrated (0.026s)
== 20170226151953-update-users: migrating =======
== 20170226151953-update-users: migrated (0.047s)
== 20170307043733-update-users2: migrating =======
== 20170307043733-update-users2: migrated (0.049s)
== 20170308023252-create-profile: migrating =======
== 20170308023252-create-profile: migrated (0.027s)
== 20170308055218-update-users3-link-profile: migrating =======
== 20170308055218-update-users3-link-profile: migrated (0.017s)
$ npm test
npm info it worked if it ends with ok
npm info using [email protected]
npm info using [email protected]
npm info lifecycle [email protected]~pretest: [email protected]
npm info lifecycle [email protected]~test: [email protected]
> [email protected] test /builds/f/f-api
> mocha --recursive --timeout 10000
module.js:597
return process.dlopen(module, path._makeLong(filename));
^
Error: Module version mismatch. Expected 48, got 51.
at Error (native)
at Object.Module._extensions..node (module.js:597:18)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/builds/focus/focus-api/node_modules/bcrypt/bcrypt.js:6:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/builds/focus/focus-api/app/helpers/auth_helper.js:1:78)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/builds/focus/focus-api/config/routes/users.js:4:21)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/builds/focus/focus-api/config/routes/index.js:4:15)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/builds/focus/focus-api/app.js:8:16)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (/builds/focus/focus-api/test/integration/routes_auth_test.js:1:75)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at /builds/focus/focus-api/node_modules/mocha/lib/mocha.js:222:27
at Array.forEach (native)
at Mocha.loadFiles (/builds/focus/focus-api/node_modules/mocha/lib/mocha.js:219:14)
at Mocha.run (/builds/focus/focus-api/node_modules/mocha/lib/mocha.js:487:10)
at Object.<anonymous> (/builds/focus/focus-api/node_modules/mocha/bin/_mocha:459:18)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
at Module.runMain (module.js:604:10)
at run (bootstrap_node.js:394:7)
at startup (bootstrap_node.js:149:9)
at bootstrap_node.js:509:3
npm info lifecycle [email protected]~test: Failed to exec test script
npm ERR! Test failed. See above for more details.
ERROR: Job failed: exit code 1
appreciate any pointer to right direction, Thank you for help!!!
How are you running the process?
If it might help anyone, we had a similar issues running node via pm2, we were getting this error: Error: Module version mismatch. Expected 48, got 57
It seems the number refers to NODE MODULE version, 48 is node 6, 57 is node 8.
We were running our pm2 processes and each process specifies a particular node version to use. They were point to node 6 versions, even thought our current nvm use version was at 8.12. (node.js version 8.12.0 )
Deleting and restarting the PM2 jobs, created the tasks with the updated link to node 8.12 and we stopped getting that error.
Hope it helps someone!
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With