thiagoelg / node-printer

Native node.js printer
129 stars 79 forks source link

Not able to use with node 16 and electron 13 - cannot find native module #50

Closed LucasHang closed 2 years ago

LucasHang commented 2 years ago

Sou brasileiro, mas como todas as issues estão em inglês...

I've tried a lot o things and there are a lot more to try yet, but if you could help me in this I would be very gratefull.

Some points are:

{
    "name": "@comanda10/pdv",
    "private": true,
    "version": "1.0.0",
    "author": {
        "name": "Pedidos10",
        "email": "contato@pedidos10.com.br"
    },
    "description": "PDV para fazer e controlar vendas",
    "main": "./.webpack/main",
    "scripts": {
        "dev": "electron-forge start",
        "package": "electron-forge package",
        "make": "electron-forge make",
        "release": "electron-forge publish",
        "lint": "eslint . --ext js,ts",
        "test": "jest"
    },
    "keywords": [],
    "license": "MIT",
    "dependencies": {
        "@comanda10/printer": "*",
        "@comanda10/sdk": "*",
        "@comanda10/types": "*",
        "@comanda10/ui-kit": "*",
        "@thiagoelg/node-printer": "^0.6.2",
        "amqplib": "^0.8.0",
        "date-fns": "2.24.0",
        "electron-log": "^4.4.6",
        "electron-squirrel-startup": "^1.0.0",
        "immer": "9.0.12",
        "node-thermal-printer": "^4.1.2",
        "react": "17.0.2",
        "react-dom": "17.0.2",
        "react-hot-loader": "4.13.0",
        "react-router": "^6.3.0",
        "react-router-dom": "^6.3.0",
        "react-xarrows": "^2.0.2",
        "styled-components": "5.3.0",
        "uuid": "^8.3.2",
        "yup": "^0.32.11"
    },
    "devDependencies": {
        "@babel/core": "7.14.6",
        "@babel/helpers": "7.14.6",
        "@babel/plugin-transform-runtime": "7.14.5",
        "@babel/preset-env": "7.14.5",
        "@babel/preset-react": "7.14.5",
        "@babel/preset-typescript": "7.14.5",
        "@babel/runtime": "7.14.6",
        "@electron-forge/cli": "6.0.0-beta.63",
        "@electron-forge/maker-deb": "6.0.0-beta.63",
        "@electron-forge/maker-rpm": "6.0.0-beta.63",
        "@electron-forge/maker-squirrel": "6.0.0-beta.63",
        "@electron-forge/maker-zip": "6.0.0-beta.63",
        "@electron-forge/plugin-webpack": "6.0.0-beta.63",
        "@electron-forge/publisher-s3": "6.0.0-beta.63",
        "@marshallofsound/webpack-asset-relocator-loader": "0.5.0",
        "@testing-library/jest-dom": "5.14.1",
        "@testing-library/react": "11.2.7",
        "@types/amqplib": "^0.8.2",
        "@types/electron-devtools-installer": "2.2.0",
        "@types/jest": "26.0.23",
        "@types/react": "17.0.11",
        "@types/react-dom": "17.0.8",
        "@types/styled-components": "5.1.10",
        "babel-loader": "8.2.2",
        "cross-env": "7.0.3",
        "css-loader": "^6.5.1",
        "dotenv": "^16.0.0",
        "electron": "13.6.6",
        "file-loader": "^6.2.0",
        "jest": "27.0.4",
        "npm-run-all": "4.1.5",
        "ts-jest": "27.0.3",
        "typescript-styled-plugin": "0.18.2",
        "wait-on": "5.3.0"
    },
    "config": {
        "forge": "./forge.config.js"
    }
}

Some of my thoughts:

If any other info is needed, please tell me

LucasHang commented 2 years ago

Trying in a separated project I found out that the problem may be with Microsoft Windows SDK. I'm using windows 11, that could be the reason image I did not fixed it yet, so I'd like to know if the library is not compatible with windows 11. If that is the case, could you build to support Windows 11 SDK? That I think is 10.0.22000

LucasHang commented 2 years ago

Solved. My case was webpack, so I add `externals: ["@thiagoelg/node-printer"]´ to webpack config and it worked