简体   繁体   English

如果我有应用程序的源代码和 macOS 和 Windows 安装程序,我如何才能找到用于构建应用程序的 Node.js 版本?

[英]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?

I need to build a new version of a javascript Node.js app.我需要构建一个新版本的 javascript Node.js应用程序。 I have the source code and the macOS and Windows installers for the previous version of the app.我有该应用程序先前版本的源代码以及 macOS 和 Windows 安装程序。

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?我怎样才能找到Node.js的哪个版本用于构建以前版本的应用程序,以便我可以使用相同的Node.js版本来构建我的新版本的应用程序?

I understand that version of Node.js could have been different when building the macOS version and the Windows version.我知道在构建 macOS 版本和 Windows 版本时, Node.js的版本可能不同。 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.理想情况下,我想知道每个平台使用的是哪个版本的Node.js ,但如果我能得到至少一个就足以满足我的需要的话。

UPDATE: package.json:更新: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 doesn't get bundled with the source code of apps. Node.js 不与应用程序的源代码捆绑在一起。 The package.json might have a section called "engines" in which it will state what version you should be using. package.json可能有一个名为"engines"的部分,其中将 state 您应该使用什么版本。

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.如果根package.json没有"engines"部分,那么某些依赖项可能会说明它们需要使用哪个版本。 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 .逐个检查会有点烦人,所以一个好方法就是下载一个版本的 Node 并运行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).如果一切正常,那么您知道创建应用程序的 Node 版本很可能较旧(我知道这有点乏味)。

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.您可以寻找的另一件事(但可能没有帮助)是检查源代码文件的创建时间(尤其是package.json文件),并找到当时发布的 Node 版本。 This wont be as accurate as the first method but it will give you a working version of Node.这不会像第一种方法那样准确,但它会给你一个 Node.js 的工作版本。

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.但是,归根结底,最好使用最新版本(或最新的 LTS 版本),因为它们带有所有最新的安全补丁和改进。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 我如何在node.js应用程序中包含JavaScript文件? - how can i include JavaScript file in node.js app? 如何在不显示API密钥的情况下使此代码正常工作? 我在Node.js / Angular / Express上构建为应用程序 - How can I make this code work without showing my API keys? I am building as app on Node.js/Angular/Express 如何从Heroku上的Node.js应用程序中的子文件夹重定向到静态javascript应用程序? - How can I redirect to static javascript app from subfolder in a Node.js app on Heroku? Node.JS + TypeScript 如何从堆栈跟踪中跟踪源代码? - Node.JS + TypeScript how I can track the source code from the stack trace? 如何解析来自node.js的JavaScript源代码 - How can I parse JavaScript source code from node.js 如何检测 macOS 上的 Node 应用程序启动文件夹? - How can I detect Node app startup folder on macOS? Windows的node.js和Cygein,如何运行代码? - node.js and Cygein for windows, how do I run code? 如何在Node.js中将变量从ejs转换为app.js? - How can I take variable from ejs to app.js in Node.js? node.js聊天应用程序中callback()的含义或源代码 - Meaning or source code for callback() in node.js chat app 如何在我的node.js Web应用程序中包含jQuery代码? - How do I include jQuery code in my node.js web app?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM