npm install gives different output on 2 computers with identical config

77 Views Asked by At

I have 2 computers. Same configuration.

  • Windows version 11
  • Node.js version 14.17.1
  • npm version 6.14.13
  • Typescript version 4.5.5

I have a package.json file. When I execute npm install the output log is different on the 2 computers. Of course the generated node_modules folders are different as well. The difference is highlighted in green below.

Only on the second computer I have the highlighted output. I would like to understand why this difference? Of course there is something for explaining that difference and it can help me to solve the issue I got when I build my app.

enter image description here

Below is my package.json file

{
  "name": "gaffeweb",
  "description": "An Aurelia client application.",
  "version": "0.1.0",
  "repository": {
    "type": "???",
    "url": "???"
  },
  "license": "MIT",
  "dependencies": {
    "@flowjs/flow.js": "^2.11.2",
    "ag-grid-aurelia": "^20.2.0",
    "ag-grid-community": "^20.2.0",
    "ag-grid-enterprise": "^20.0.0",
    "aurelia-animator-css": "^1.0.4",
    "aurelia-binding": "2.1.7",
    "aurelia-bootstrapper": "2.3.3",
    "aurelia-breeze": "^2.2.0",
    "aurelia-dialog": "^1.1.0",
    "aurelia-i18n": ">=2.3.2",
    "aurelia-materialize-bridge": "1.2.5",
    "aurelia-templating": "^1.10.1",
    "aurelia-typed-observable-plugin": "^0.4.2",
    "aurelia-validation": "^1.6.0",
    "babel-eslint": "^10.0.1",
    "bluebird": "^3.5.3",
    "breeze-client": "^1.7.2",
    "i18next": "^6.1.2",
    "jquery": "^3.3.1",
    "jqueryui": "^1.11.1",
    "jstree": "^3.3.7",
    "materialize-css": "^1.0.0",
    "metro-dist": "^3.0.18",
    "moment": "^2.24.0",
    "node-sass": "^6.0.1",
    "nprogress": "^0.2.0",
    "requirejs": "^2.3.6",
    "select2": "^4.0.5",
    "svgxuse": "^1.2.6",
    "text": "github:requirejs/text#latest",
    "toastr": "^2.1.4",
    "trumbowyg": "^2.13.0",
    "tslib": "^1.9.3",
    "whatwg-fetch": "^2.0.4",
    "cors": "^2.8.5"
  },
  "peerDependencies": {},
  "devDependencies": {
    "@types/breeze": "^1.6.2",
    "@types/jquery": "^3.3.29",
    "@types/jqueryui": "^1.12.6",
    "@types/materialize-css": "^1.0.6",
    "@types/select2": "^4.0.47",
    "aurelia-cli": "^1.0.0-beta.11",
    "aurelia-testing": "^1.0.0",
    "aurelia-tools": "^2.0.0",
    "browser-sync": "^2.26.0",
    "connect-history-api-fallback": "^1.6.0",
    "debounce": "^1.2.0",
    "event-stream": "^3.3.3",
    "fs": "0.0.1-security",
    "gulp": "^4.0.0",
    "gulp-changed-in-place": "^2.3.0",
    "gulp-htmlmin": "^5.0.1",
    "gulp-notify": "^3.2.0",
    "gulp-plumber": "^1.2.0",
    "gulp-rename": "^1.4.0",
    "gulp-sass": "^4.0.1",
    "gulp-shell": ">=0.6.5",
    "gulp-sourcemaps": "^2.6.4",
    "gulp-tslint": "^8.1.3",
    "gulp-typescript": "^5.0.0-alpha.3",
    "gulp-watch": "^5.0.1",
    "html-minifier": "^3.5.20",
    "merge2": "^1.2.3",
    "minimatch": "^3.0.4",
    "through2": "^2.0.3",
    "tslint": "^5.12.1",
    "typescript": "^3.2.4",
    "vinyl-fs": "^3.0.3"
  }
}
2

There are 2 best solutions below

2
VonC On BEST ANSWER

To make sure you have the same conditions on both machines, you can try, for testing, to clear the npm cache on both machine (npm cache clean --force), and to list the globally installed npm packages, to check they are the same on both machines (npm list -g --depth=0).
This assumes the same Node.js and npm versions on both machines, as you mentioned.

Then reinstall node modules:

rm -rf node_modules package-lock.json
npm install

That should force a fresh installation of all dependencies.

Make sure both machines have the same relevant environment variables set, and the same npm config (npm config list)
Also, make sure the file systems are the same and that there are no permission issues with the directories where npm is attempting to install packages.

For your specific issue, you can start by focusing on the es5-ext package and its postinstall script. I do not see any obvious recent issue.
Try and temporarily remove es5-ext from your dependencies to confirm if it is the source of the inconsistency.

0
David Bradshaw On

There is not a lot to go on in your question.

Things you might try:

If you’re not using package-json.lock then enable it on the good machine, run another build and then copy it over to other machine.

Another thing that can sometime help, is to delete node-modules and package-json.lock. Then rerun npm install.

Finally you’re running a pretty old version of Node. Have you tried upgrading it? Perhaps by using nvm so you can easily switch between versions.