0

Is it possible to have different node versions (lts and current) and have the same package-lock.json?

Currently when I run npm install the packages it generates are different to those specified in the package-lock.json file.

For example I'm using nvm (node version manager) to test different node versions on the same machine.

nvm exec v10.3.0 npm i outputs package-lock.json :

"babel-generator": {
  "version": "6.26.1",
  "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
  "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
  "dev": true,
  "requires": {
    "babel-messages": "^6.23.0",
    "babel-runtime": "^6.26.0",
    "babel-types": "^6.26.0",
    "detect-indent": "^4.0.0",
    "jsesc": "^1.3.0",
    "lodash": "^4.17.4",
    "source-map": "^0.5.7",
    "trim-right": "^1.0.1"
  }
},

nvm exec v8.11.2 npm i outputs package-lock.json :

 "babel-generator": {
  "version": "6.26.1",
  "resolved": "https://registry.npmjs.org/babel-generator/-/babel-generator-6.26.1.tgz",
  "integrity": "sha512-HyfwY6ApZj7BYTcJURpM5tznulaBvyio7/0d4zFOeMPUmfxkCjHocCuoLa2SAGzBI8AREcH3eP3758F672DppA==",
  "dev": true,
  "requires": {
    "babel-messages": "6.23.0",
    "babel-runtime": "6.26.0",
    "babel-types": "6.26.0",
    "detect-indent": "4.0.0",
    "jsesc": "1.3.0",
    "lodash": "4.17.10",
    "source-map": "0.5.7",
    "trim-right": "1.0.1"
  }
},

And because of that a lot of git conflicts keep happening between these two version.

Is there any configuration in package.json to have same output for package-lock.json ?

OvidijusR
  • 158
  • 2
  • 12

0 Answers0