if I have source code and macOS and Windows installers for an app, how can I find what version of Node.js was used to build the app?

扶醉桌前 提交于 2020-06-28 05:17:36

问题


I need to build a new version of a javascript Node.js app. I have the source code and the macOS and Windows installers for the previous version of the app.

How can I find what version of Node.js was used to build the previous version of the app, so I can use the same Node.js version to build my new version of the app?

I understand that version of Node.js could have been different when building the macOS version and the Windows version. Ideally, I'd like to know what version of Node.js was used for each platform, but if I can get at least one that would be sufficient for my needs.

UPDATE: package.json:

{
  "name": "LiteracyStarter",
  "description": "Literacy Starter",
  "version": "0.60.1",
  "activated": true,
  "private": true,
  "main": "./build/LiteracyStarter.html",
  "nodejs": true,
  "chromium-args": "--disable-web-security",
  "window": {
    "toolbar": true,
    "width": 1260,
    "height": 750,
    "icon": "./images/LiteracyStarterIcon.png",
    "show": false
  },
  "dependencies": {
    "archiver": "^2.1.1",
    "arraybuffer-to-buffer": "0.0.4",
    "babel-plugin-transform-object-rest-spread": "^6.23.0",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-polyfill": "^6.23.0",
    "cf-encrypt": "^1.0.0",
    "cli-spinner": "^0.2.6",
    "co": "^4.6.0",
    "co-fs": "^1.2.0",
    "co-fs-extra": "^1.2.1",
    "d3-dsv": "^1.0.7",
    "decompress-zip": "^0.3.0",
    "dexie": "^1.5.1",
    "esrever": "^0.2.0",
    "form-data": "^2.2.0",
    "fs-extra": "^0.23.1",
    "fs-extra-promise": "^1.0.1",
    "fstream": "^1.0.11",
    "image-size": "^0.3.5",
    "is-online": "^5.2.0",
    "jssha": "^2.3.1",
    "jszip": "^2.6.1",
    "lodash": "^3.10.1",
    "markdown-it": "^8.3.1",
    "memoizejs": "^0.1.1",
    "moment": "^2.18.1",
    "parse-error": "^0.2.0",
    "portscanner": "^1.2.0",
    "promise-alert": "^0.1.1",
    "promisify-node": "^0.4.0",
    "pseries": "^1.0.3",
    "quill": "^0.20.1",
    "react": "^15.6.1",
    "react-addons-perf": "^15.4.2",
    "react-dom": "^15.6.1",
    "read-json-stream": "^1.1.0",
    "redux": "^3.7.2",
    "request": "^2.81.0",
    "rimraf": "^2.6.1",
    "rmrf-promise": "^1.1.0",
    "simple-sort": "^0.1.2",
    "socket.io": "^1.7.4",
    "socket.io-client": "^1.7.4",
    "socket.io-stream": "^0.9.1",
    "superagent": "^1.8.5",
    "sweetalert": "^1.1.3",
    "system-font-families": "^1.0.0",
    "ttfinfo": "^0.2.0",
    "unzip": "^0.1.11",
    "uuid": "^3.1.0",
    "webpack": "^3.8.1",
    "workerjs": "^0.1.1",
  },
  "optionalDependencies": {
    "appdmg": "^0.4.5"
  },
  "devDependencies": {
    "babel-cli": "^6.6.5",
    "babel-core": "^6.7.0",
    "babel-loader": "^6.2.4",
    "babel-plugin-syntax-async-functions": "^6.13.0",
    "babel-plugin-transform-es2015-modules-commonjs": "^6.18.0",
    "babel-preset-es2015": "^6.6.0",
    "babel-preset-react": "^6.5.0",
    "babel-register": "^6.9.0",
    "colors": "^1.1.2",
    "eslint": "^2.13.1",
    "eslint-plugin-react": "^4.3.0",
    "express": "^4.13.1",
    "grunt": "^0.4.5",
    "grunt-babel": "^6.0.0",
    "grunt-cli": "^1.3.2",
    "grunt-contrib-copy": "^0.8.0",
    "grunt-contrib-cssmin": "^0.12.3",
    "grunt-contrib-requirejs": "^0.4.4",
    "grunt-contrib-uglify": "^0.8.0",
    "grunt-contrib-watch": "^0.6.1",
    "grunt-nw-builder": "^3.1.0",
    "grunt-sloc": "^0.6.0",
    "grunt-webpack": "^3.0.2",
    "mocha": "^2.2.4",
    "nw-builder": "^3.1.0",
    "react-tools": "^0.13.3",
    "requirejs": "^2.1.17",
    "s3": "^4.4.0",
    "should": "^8.4.0",
    "single-line-log": "^1.1.2",
    "underscore.string": "^3.0.3"
  },
  "scripts": {
    "start": "cd build && nw .",
    "dev-start": "cd build && NODE_ENV=development nw . --load-extension=../../react-devtools",
    "build": "npm install && bower install && grunt build && cd build && npm install --production",
    "build-native": "node build-native.js",
    "localization-helper": "cd localizationHelper && http-server",
    "code-generator": "node ./code-generator/code-generator.js",
    "generate-docs": "jsdoc app-node -r -d docs-node && jsdoc app-client/js -r -d docs-client",
    "watch-node": "babel app-node --watch --out-dir build/app-node",
    "watch-client": "webpack --watch --progress",
    "watch-all": "grunt watch",
    "compile-setup-scripts": "node compile-setup-scripts.js",
    "comment": "For node 10.x, we have to add git-core to the PATH when we run win-complete-build.  See https://github.com/appveyor/ci/issues/2420 for an example.",
    "win-complete-build": "PATH=%PATH%;C:\\Program Files\\Git\\mingw64\\libexec\\git-core && npm run build && npm run build-native && npm run compile-setup-scripts",
    "test-sy-utils": "mocha --compilers js:babel-register ./test/sy-utils-tests.js",
    "test-flashcards": "mocha --compilers js:babel-register ./test/flashcard-generator-tests.js",
    "build-native-linux": "cd build-native/LiteracyStarter/linux64/ && node-deb -- **"
  },
  "cutoffDate": "",
  "preLiteracyVersion": "0.20.2",
  "id": "47479c35-18d9-4265-ad85-af5a73080450"
}


回答1:


Node.js doesn't get bundled with the source code of apps. The package.json might have a section called "engines" in which it will state what version you should be using.

If the root package.json doesn't have the "engines" section, then it may be posable that the some of the dependencies do say which version they require to be used. It would be kind of annoying going through each one to check, so a good way would be just to download a version of Node and run npm install. If everything works, then you know that the Node version the app was created in is most likely older (its a bit tedious, I know).

Another thing you could look for (but might not be to helpful) would be to check when the files of the source code were created (especially the package.json file), and find the Node version that was released around that time. This wont be as accurate as the first method but it will give you a working version of Node.

When it comes down to it though, its probably always best to use the most up to date version (or the most recent LTS version) as they come with all the latest security patches and improvements.



来源:https://stackoverflow.com/questions/61648811/if-i-have-source-code-and-macos-and-windows-installers-for-an-app-how-can-i-fin

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!