我需要构建一个新版本的javascriptNode.js
应用程序。我有以前版本的应用程序的源代码以及macOS和Windows安装程序。
我如何找到Node.js
的哪个版本用于构建以前版本的应用程序,以便我可以使用相同的Node.js
版本来构建我的新版本应用程序?
我知道Node.js
的版本在构建macOS版本和Windows版本时可能会有所不同。理想情况下,我想知道每个平台使用的是什么版本的Node.js
,但如果我能至少获得一个,那就足够满足我的需求了。
更新: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"
}
Node.js没有与应用程序的源代码捆绑在一起。package.json
可能有一个名为"engines"
的部分,它将在其中说明您应该使用的版本。
如果根package.json
没有"engines"
部分,那么可能有些依赖项确实说明了它们需要使用哪个版本。检查每一个都会有点烦人,所以一个好方法就是下载Node的一个版本并运行npm install
。如果一切正常,那么你就知道创建该应用程序的Node版本很可能更旧(我知道这有点乏味(。
您可以查找的另一件事(但可能没有帮助(是检查源代码的文件是何时创建的(尤其是package.json
文件(,并找到当时发布的Node版本。这不会像第一种方法那样准确,但它会给你一个Node的工作版本。
不过,归根结底,最好使用最新的版本(或最新的LTS版本(,因为它们带有所有最新的安全补丁和改进。