sebhildebrandt / osx-temperature-sensor

OSX temperature sensor
MIT License
19 stars 7 forks source link

error osx-temperature-sensor@1.0.7: The platform "win32" is incompatible with this module. #8

Closed alihassan18 closed 2 years ago

alihassan18 commented 3 years ago

I am using this package in the electron app. It works fine on Mac but doesn't even install on Windows. I am getting this error, how can I resolve this.

error osx-temperature-sensor@1.0.7: The platform "win32" is incompatible with this module.
error Found incompatible module.
sebhildebrandt commented 3 years ago

@alihassan18 Can you show your package.json

alihassan18 commented 3 years ago

@alihassan18 Can you show your package.json

{
  "name": "",
  "productName": "",
  "version": "2.1.6",
  "description": "",
  "main": "./main.prod.js",
  "author": {
    "name": "",
    "email": "",
    "url": "https://github.com/libonomy-os"
  },
  "scripts": {
    "electron-rebuild": "node -r ../.erb/scripts/BabelRegister.js ../.erb/scripts/ElectronRebuild.js",
    "postinstall": "yarn electron-rebuild"
  },
  "license": "MIT",
  "dependencies": {
  },
  "devDependencies": {
    "@types/react-custom-scrollbars": "^4.0.7",
    "@types/react-slick": "^0.23.4"
  }
}
sebhildebrandt commented 3 years ago

@alihassan18 Your dependencies is completely empty. I do not see systeminformation at all ... is this the right package.json? Maybe you can point me to the repo of your project, then it would be easier to isolate the problem.

alihassan18 commented 3 years ago

@alihassan18 Your dependencies is completely empty. I do not see systeminformation at all ... is this the right package.json? Maybe you can point me to the repo of your project, then it would be easier to isolate the problem.

Check it now.

{
  "name": "",
  "productName": "",
  "description": "",
  "scripts": {
    "build": "concurrently \"yarn build:main\" \"yarn build:renderer\"",
    "build:main": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.main.prod.babel.js",
    "build:renderer": "cross-env NODE_ENV=production webpack --config ./.erb/configs/webpack.config.renderer.prod.babel.js",
    "dev": "cross-env START_HOT=1 node -r @babel/register ./.erb/scripts/CheckPortInUse.js && cross-env START_HOT=1 yarn start:renderer",
    "rebuild": "electron-rebuild --parallel --types prod,dev,optional --module-dir src",
    "lint": "cross-env NODE_ENV=development eslint . --cache --ext .js,.jsx,.ts,.tsx",
    "package": "rm -rf src/dist && yarn build && electron-builder build --publish never",
    "postinstall": "node -r @babel/register .erb/scripts/CheckNativeDep.js && electron-builder install-app-deps && yarn cross-env NODE_ENV=development webpack --config ./.erb/configs/webpack.config.renderer.dev.dll.babel.js && opencollective-postinstall && yarn-deduplicate yarn.lock",
    "start": "node -r @babel/register ./.erb/scripts/CheckPortInUse.js && yarn start:renderer",
    "start:main": "cross-env NODE_ENV=development electron -r ./.erb/scripts/BabelRegister ./src/main.dev.ts",
    "start:renderer": "cross-env NODE_ENV=development webpack serve --config ./.erb/configs/webpack.config.renderer.dev.babel.js",
    "test": "jest"
  },
  "lint-staged": {
    "*.{js,jsx,ts,tsx}": [
      "cross-env NODE_ENV=development eslint --cache"
    ],
    "{*.json,.{babelrc,eslintrc,prettierrc}}": [
      "prettier --ignore-path .eslintignore --parser json --write"
    ],
    "*.{css,scss}": [
      "prettier --ignore-path .eslintignore --single-quote --write"
    ],
    "*.{html,md,yml}": [
      "prettier --ignore-path .eslintignore --single-quote --write"
    ]
  },
  "build": {
    "productName": "",
    "appId": "",
    "files": [
      "dist/",
      "node_modules/",
      "index.html",
      "main.prod.js",
      "main.prod.js.map",
      "package.json"
    ],
    "afterSign": ".erb/scripts/Notarize.js",
    "mac": {
      "target": [
        "dmg"
      ],
      "type": "distribution",
      "hardenedRuntime": true,
      "entitlements": "assets/entitlements.mac.plist",
      "entitlementsInherit": "assets/entitlements.mac.plist",
      "gatekeeperAssess": false
    },
    "dmg": {
      "contents": [
        {
          "x": 130,
          "y": 220
        },
        {
          "x": 410,
          "y": 220,
          "type": "link",
          "path": "/Applications"
        }
      ]
    },
    "win": {
      "target": [
        "nsis"
      ],
      "certificateFile": "./cert/",
      "certificatePassword": "",
      "verifyUpdateCodeSignature": false
    },
    "linux": {
      "target": [
        "AppImage"
      ],
      "category": "Development"
    },
    "directories": {
      "app": "src",
      "buildResources": "assets",
      "output": "release"
    },
    "extraResources": [
      "./assets/**"
    ],
    "publish": [
      {
        "provider": "generic",
        "url": ""
      }
    ]
  },
  "repository": {
    "type": "git",
    "url": ""
  },
  "author": {
    "name": "",
    "email": "",
    "url": ""
  },
  "contributors": [
    {
      "name": "M.Usman",
      "email": "usman.ramay@magnusmage.com",
      "url": ""
    },
    {
      "name": "Ali Hassan",
      "email": "ali.hassan@magnusmage.com",
      "url": ""
    },
    {
      "name": "M.Jibran",
      "email": "jibran.baig@magnusmage.com",
      "url": ""
    }
  ],
  "license": "MIT",
  "bugs": {
  },
  "jest": {
    "testURL": "http://localhost/",
    "moduleNameMapper": {
      "\\.(jpg|jpeg|png|gif|eot|otf|webp|svg|ttf|woff|woff2|mp4|webm|wav|mp3|m4a|aac|oga)$": "<rootDir>/.erb/mocks/fileMock.js",
      "\\.(css|less|sass|scss)$": "identity-obj-proxy"
    },
    "moduleFileExtensions": [
      "js",
      "jsx",
      "ts",
      "tsx",
      "json"
    ],
    "moduleDirectories": [
      "node_modules",
      "src/node_modules"
    ],
    "setupFiles": [
      "./.erb/scripts/CheckBuildsExist.js"
    ]
  },
  "devDependencies": {
    "@babel/core": "^7.12.9",
    "@babel/plugin-proposal-class-properties": "^7.12.1",
    "@babel/plugin-proposal-decorators": "^7.12.1",
    "@babel/plugin-proposal-do-expressions": "^7.12.1",
    "@babel/plugin-proposal-export-default-from": "^7.12.1",
    "@babel/plugin-proposal-export-namespace-from": "^7.12.1",
    "@babel/plugin-proposal-function-bind": "^7.12.1",
    "@babel/plugin-proposal-function-sent": "^7.12.1",
    "@babel/plugin-proposal-json-strings": "^7.12.1",
    "@babel/plugin-proposal-logical-assignment-operators": "^7.12.1",
    "@babel/plugin-proposal-nullish-coalescing-operator": "^7.12.1",
    "@babel/plugin-proposal-optional-chaining": "^7.12.7",
    "@babel/plugin-proposal-pipeline-operator": "^7.12.1",
    "@babel/plugin-proposal-throw-expressions": "^7.12.1",
    "@babel/plugin-syntax-dynamic-import": "^7.8.3",
    "@babel/plugin-syntax-import-meta": "^7.10.4",
    "@babel/plugin-transform-react-constant-elements": "^7.12.1",
    "@babel/plugin-transform-react-inline-elements": "^7.12.1",
    "@babel/plugin-transform-runtime": "^7.12.1",
    "@babel/preset-env": "^7.12.7",
    "@babel/preset-react": "^7.12.7",
    "@babel/preset-typescript": "^7.12.7",
    "@babel/register": "^7.12.1",
    "@pmmmwh/react-refresh-webpack-plugin": "^0.4.3",
    "@teamsupercell/typings-for-css-modules-loader": "^2.4.0",
    "@testing-library/jest-dom": "^5.11.6",
    "@testing-library/react": "^11.2.2",
    "@types/enzyme": "^3.10.5",
    "@types/enzyme-adapter-react-16": "^1.0.6",
    "@types/history": "4.7.6",
    "@types/jest": "^26.0.15",
    "@types/node": "14.14.10",
    "@types/react": "^16.9.44",
    "@types/react-dom": "^16.9.9",
    "@types/react-router-dom": "^5.1.7",
    "@types/react-test-renderer": "^16.9.3",
    "@types/styled-components": "^5.1.9",
    "@types/webpack-env": "^1.15.2",
    "@typescript-eslint/eslint-plugin": "^4.8.1",
    "@typescript-eslint/parser": "^4.8.1",
    "babel-eslint": "^10.1.0",
    "babel-jest": "^26.1.0",
    "babel-loader": "^8.2.2",
    "babel-plugin-dev-expression": "^0.2.2",
    "babel-plugin-transform-react-remove-prop-types": "^0.4.24",
    "browserslist-config-erb": "^0.0.1",
    "chalk": "^4.1.0",
    "concurrently": "^5.3.0",
    "core-js": "^3.13.0",
    "cross-env": "^7.0.2",
    "css-loader": "^5.0.1",
    "css-minimizer-webpack-plugin": "^1.1.5",
    "detect-port": "^1.3.0",
    "electron": "^8.5.2",
    "electron-builder": "^22.10.5",
    "electron-devtools-installer": "^3.1.1",
    "electron-notarize": "^1.0.0",
    "electron-rebuild": "^2.3.2",
    "enzyme": "^3.11.0",
    "enzyme-adapter-react-16": "^1.15.3",
    "enzyme-to-json": "^3.5.0",
    "eslint": "^7.5.0",
    "eslint-config-airbnb": "^18.2.0",
    "eslint-config-airbnb-typescript": "^12.0.0",
    "eslint-config-erb": "^2.0.0",
    "eslint-config-prettier": "^6.11.0",
    "eslint-import-resolver-webpack": "^0.13.0",
    "eslint-plugin-compat": "^3.8.0",
    "eslint-plugin-import": "^2.22.0",
    "eslint-plugin-jest": "^24.1.3",
    "eslint-plugin-jsx-a11y": "6.4.1",
    "eslint-plugin-prettier": "^3.1.4",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-react": "^7.20.6",
    "eslint-plugin-react-hooks": "^4.0.8",
    "file-loader": "^6.0.0",
    "husky": "^4.2.5",
    "identity-obj-proxy": "^3.0.0",
    "jest": "^26.1.0",
    "lint-staged": "^10.2.11",
    "mini-css-extract-plugin": "^1.3.1",
    "node-sass": "^5.0.0",
    "opencollective-postinstall": "^2.0.3",
    "prettier": "^2.0.5",
    "react-refresh": "^0.9.0",
    "react-test-renderer": "^17.0.1",
    "rimraf": "^3.0.0",
    "sass-loader": "^10.1.0",
    "style-loader": "^2.0.0",
    "terser-webpack-plugin": "^5.0.3",
    "typescript": "^4.0.5",
    "url-loader": "^4.1.0",
    "webpack": "^5.5.1",
    "webpack-bundle-analyzer": "^4.1.0",
    "webpack-cli": "^4.2.0",
    "webpack-dev-server": "^3.11.0",
    "webpack-merge": "^5.4.0",
    "yarn-deduplicate": "^3.1.0"
  },
  "dependencies": {
    "@grpc/grpc-js": "^1.3.2",
    "@grpc/proto-loader": "^0.6.2",
    "@libonomy/cuspstakejs": "^2.1.1",
    "@material-ui/core": "^4.11.4",
    "@material-ui/icons": "^4.11.2",
    "@material-ui/lab": "^4.0.0-alpha.58",
    "aes-js": "^3.1.2",
    "auto-launch": "^5.0.5",
    "axios": "^0.21.1",
    "bip39": "^3.0.4",
    "copy-to-clipboard": "^3.3.1",
    "dotenv": "^10.0.0",
    "electron-debug": "^3.1.0",
    "electron-fetch": "^1.7.3",
    "electron-log": "^4.2.4",
    "electron-store": "^8.0.0",
    "electron-unhandled": "^3.0.2",
    "electron-updater": "^4.3.4",
    "eol": "^0.9.1",
    "find-process": "^1.4.4",
    "history": "^5.0.0",
    "ignore": "^5.1.8",
    "js-xdr": "^1.3.0",
    "moment": "^2.29.1",
    "notistack": "^1.0.9",
    "pbkdf2": "^3.1.2",
    "perfect-scrollbar": "^1.5.1",
    "pidusage": "^2.0.21",
    "qrcode.react": "^1.0.1",
    "react": "^17.0.1",
    "react-circular-progressbar": "^2.0.4",
    "react-custom-scrollbars": "^4.2.1",
    "react-dom": "^17.0.1",
    "react-hot-loader": "^4.13.0",
    "react-is": "^17.0.1",
    "react-number-format": "^4.6.3",
    "react-otp-input": "^2.4.0",
    "react-phone-input-2": "^2.7.1",
    "react-phone-number-input": "^3.1.23",
    "react-redux": "^7.2.4",
    "react-router-dom": "^5.2.0",
    "react-slick": "^0.28.1",
    "react-transition-group": "^4.4.2",
    "recharts": "^2.0.9",
    "redux": "^4.1.0",
    "redux-devtools-extension": "^2.13.9",
    "redux-thunk": "^2.3.0",
    "regenerator-runtime": "^0.13.7",
    "shelljs": "^0.8.4",
    "socket.io-client": "2.2.0",
    "source-map-support": "^0.5.19",
    "styled-components": "^5.0.0",
    "systeminformation": "^5.7.13",
    "validate.js": "^0.13.1"
  },
  "devEngines": {
    "node": ">=10.x",
    "npm": ">=6.x",
    "yarn": ">=1.21.3"
  },
  "collective": {
    "url": ""
  },
  "browserslist": [],
  "prettier": {
    "overrides": [
      {
        "files": [
          ".prettierrc",
          ".babelrc",
          ".eslintrc"
        ],
        "options": {
          "parser": "json"
        }
      }
    ],
    "singleQuote": true
  }
}
sebhildebrandt commented 3 years ago

@alihassan18 Ok, so as systeminformation has no explicit dependency to osx-temperature-sensor, and in the two provided package-json we also do not see this as a dependency, it seems, that webpack or electron-builder tries to do this somehow on its own.

In systeminformation I only require osx-temperature-sensor if I am on osx / darwin AND this is also installed (try catch block):

      if (_darwin) {
        let osxTemp = null;
        try {
          osxTemp = require('osx-temperature-sensor');
        } catch (er) {
          ...
        }
        ...
      }