首页 > 解决方案 > Electron 桌面应用程序在它应该是离线应用程序时尝试 TCP 连接

问题描述

我有一个使用电子构建的 Windows 客户端应用程序。我没有配置任何自动更新功能,也没有网络服务或网络需求。该应用程序旨在成为独立的桌面应用程序。但是,我注意到从构建的可执行文件到我的防火墙捕获的随机 IP 地址的 tcp 连接尝试。当我查找 IP 地址时,它是某个亚马逊托管服务器。

电子中是否有设置强制它和任何依赖项成为独立应用程序?有没有办法追踪尝试这种连接的原因?我忽略了什么吗?

我用来构建的命令:

npm install
npm install --global --production windows-build-tools

npm 运行构建

下面是我的 package.json。

{
  "name": "project",
  "version": "1.0.0",
  "author": "Project Team",
  "description": "Stand-alone Application",
  "license": null,
  "main": "./dist/electron/main.js",
  "scripts": {
    "build": "node .electron-vue/build.js && electron-builder",
    "build:dir": "node .electron-vue/build.js && electron-builder --dir",
    "build:clean": "cross-env BUILD_TARGET=clean node .electron-vue/build.js",
    "build:web": "cross-env BUILD_TARGET=web node .electron-vue/build.js",
    "dev": "node .electron-vue/dev-runner.js",
    "watch": "cross-env BUILD_TARGET=web node .electron-vue/dev-runner.js",
    "e2e": "npm run pack && mocha test/e2e",
    "lint": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter src test",
    "lint:fix": "eslint --ext .js,.vue -f ./node_modules/eslint-friendly-formatter --fix src test",
    "pack": "npm run pack:main && npm run pack:renderer",
    "pack:main": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.main.config.js",
    "pack:renderer": "cross-env NODE_ENV=production webpack --progress --colors --config .electron-vue/webpack.renderer.config.js",
    "test": "npm run unit && npm run e2e",
    "unit": "karma start test/unit/karma.conf.js",
    "postinstall": "electron-builder install-app-deps"
  },
  "build": {
    "productName": "project",
    "appId": "com.project",
    "directories": {
      "output": "build"
    },
    "nsis": {
      "perMachine": true,
      "allowElevation": true,
      "include": "installer/installer.nsh",
      "createDesktopShortcut": "always",
      "oneClick": false,
      "runAfterFinish": false,
      "guid": "project"
    },
    "files": [
      "dist/electron/**/*"
    ],
    "dmg": {
      "contents": [
        {
          "x": 410,
          "y": 150,
          "type": "link",
          "path": "/Applications"
        },
        {
          "x": 130,
          "y": 150,
          "type": "file"
        }
      ]
    },
    "mac": {
      "icon": "build/icons/icon.icns"
    },
    "win": {
      "icon": "build/icons/Project3_256.png"
    },
    "linux": {
      "icon": "build/icons"
    }
  },
  "dependencies": {
    "axios": "^0.16.2",
    "dialogs": "^1.1.20",
    "jsonfile": "^5.0.0",
    "libxmljs": "^0.19.5",
    "lodash": "^4.17.11",
    "luxon": "^1.10.0",
    "minimist": "^1.2.0",
    "node-cmd": "^3.0.0",
    "really-relaxed-json": "^0.2.24",
    "regedit": "^3.0.2",
    "relaxed-json": "^1.0.1",
    "sqlite3-offline": "^4.0.6",
    "username": "^4.0.0",
    "uuid": "^3.3.2",
    "vue": "^2.5.17",
    "vue-electron": "^1.0.6",
    "vue-router": "^2.8.1",
    "vuetify": "^1.3.5",
    "vuex": "^3.0.1"
  },
  "devDependencies": {
    "babel-core": "^6.25.0",
    "babel-eslint": "^7.2.3",
    "babel-loader": "^7.1.1",
    "babel-plugin-istanbul": "^4.1.1",
    "babel-plugin-transform-runtime": "^6.23.0",
    "babel-preset-env": "^1.6.0",
    "babel-preset-stage-0": "^6.24.1",
    "babel-register": "^6.24.1",
    "babili-webpack-plugin": "^0.1.2",
    "cfonts": "^1.1.3",
    "chai": "^4.0.0",
    "chalk": "^2.1.0",
    "copy-webpack-plugin": "^4.0.1",
    "cross-env": "^5.0.5",
    "css-loader": "^0.28.4",
    "del": "^3.0.0",
    "devtron": "^1.4.0",
    "electron": "^1.7.5",
    "electron-builder": "^20.38.4",
    "electron-debug": "^1.4.0",
    "electron-devtools-installer": "^2.2.0",
    "eslint": "^4.4.1",
    "eslint-config-standard": "^10.2.1",
    "eslint-friendly-formatter": "^3.0.0",
    "eslint-loader": "^1.9.0",
    "eslint-plugin-html": "^3.1.1",
    "eslint-plugin-import": "^2.7.0",
    "eslint-plugin-node": "^5.1.1",
    "eslint-plugin-promise": "^3.5.0",
    "eslint-plugin-standard": "^3.0.1",
    "extract-text-webpack-plugin": "^3.0.0",
    "file-loader": "^0.11.2",
    "html-webpack-plugin": "^2.30.1",
    "inject-loader": "^3.0.0",
    "karma": "^1.3.0",
    "karma-chai": "^0.1.0",
    "karma-coverage": "^1.1.1",
    "karma-electron": "^5.1.1",
    "karma-mocha": "^1.2.0",
    "karma-sourcemap-loader": "^0.3.7",
    "karma-spec-reporter": "^0.0.31",
    "karma-webpack": "^2.0.1",
    "mocha": "^3.0.2",
    "multispinner": "^0.2.1",
    "node-loader": "^0.6.0",
    "require-dir": "^0.3.0",
    "spectron": "^3.7.1",
    "style-loader": "^0.18.2",
    "stylus": "^0.54.5",
    "stylus-loader": "^3.0.1",
    "url-loader": "^0.5.9",
    "vue-html-loader": "^1.2.4",
    "vue-loader": "^13.0.5",
    "vue-style-loader": "^3.0.1",
    "vue-template-compiler": "^2.4.2",
    "webpack": "^3.5.2",
    "webpack-dev-server": "^2.7.1",
    "webpack-hot-middleware": "^2.18.2",
    "webpack-merge": "^4.1.0"
  }
}

如果您需要更多信息,请告诉我。

标签: javascriptnode.jsnpmelectronelectron-builder

解决方案


推荐阅读