tojocky / node-printer

Native node.js printer
1.53k stars 441 forks source link

Unable to install from NPM #302

Closed roicp closed 1 year ago

roicp commented 3 years ago

Hi,

I just started a brand new project using npm init -y and tried to add the printer package using npm install printer, but I always get the same error non matter what I try.

npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm ERR! code 1
npm ERR! path C:\Sources\teste-printer\node_modules\printer
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c "npm install node-gyp node-pre-gyp"
npm ERR! npm ERR! code ERESOLVE
npm ERR! npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! npm ERR!
npm ERR! npm ERR! While resolving: printer@0.4.0
npm ERR! npm ERR! Found: grunt@1.3.0
npm ERR! npm ERR! node_modules/grunt
npm ERR! npm ERR!   dev grunt@"^1.0.4" from the root project
npm ERR! npm ERR!
npm ERR! npm ERR! Could not resolve dependency:
npm ERR! npm ERR! peer grunt@"~0.4" from grunt-node-gyp@1.0.0
npm ERR! npm ERR! node_modules/grunt-node-gyp
npm ERR! npm ERR!   dev grunt-node-gyp@"git://github.com/tojocky/grunt-node-gyp.git" from the root project
npm ERR! npm ERR!
npm ERR! npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR! npm ERR!
npm ERR! npm ERR! See C:\Users\roicp\AppData\Local\npm-cache\eresolve-report.txt for a full report.
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in:
npm ERR! npm ERR!     C:\Users\roicp\AppData\Local\npm-cache\_logs\2020-11-09T19_34_53_574Z-debug.log

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\roicp\AppData\Local\npm-cache\_logs\2020-11-09T19_34_53_650Z-debug.log

I tried to

npm install printer --build-from-source
npm install printer --force
npm install printer --legacy-peer-deps

Also tried build using electron-rebuild -f -w printer (electron: 10.1.5 and electron-rebuild: 2.3.2) and this time I got a "not valid win32 application"

My project.json looks like this

{
  "name": "teste-printer",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "rebuild-node-printer": "electron-rebuild -f -w printer"
  },
  "keywords": [],
  "author": "",
  "license": "ISC",
  "devDependencies": {
    "electron": "^10.1.5",
    "electron-rebuild": "^2.3.2"
  }
}

I'm running Windows 10 (build 19042) with NodeJS 15.1.0, NPM 7.0.8 and Python 3.8.0

Does anyone have any suggestions on how I should proceed to solve the problem?

Thanks in advance

filipesarturi commented 3 years ago

same here

k2s commented 3 years ago

this helped me under Linux and MacOS: export npm_config_legacy_peer_deps=true

konni commented 3 years ago

Thanks @k2s your solution worked for me.

altruios commented 3 years ago

npm ERR! path R:\MPI_react\server\node_modules\printer npm ERR! command failed npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c npm install node-gyp node-pre-gyp npm ERR! npm ERR! code ERESOLVE npm ERR! npm ERR! ERESOLVE unable to resolve dependency tree npm ERR! npm ERR! npm ERR! npm ERR! While resolving: printer@0.4.0 npm ERR! npm ERR! Found: grunt@1.3.0 npm ERR! npm ERR! node_modules/grunt npm ERR! npm ERR! dev grunt@"^1.0.4" from the root project npm ERR! npm ERR! npm ERR! npm ERR! Could not resolve dependency: npm ERR! npm ERR! peer grunt@"~0.4" from grunt-node-gyp@1.0.0 npm ERR! npm ERR! node_modules/grunt-node-gyp npm ERR! npm ERR! dev grunt-node-gyp@"git://github.com/tojocky/grunt-node-gyp.git" from the root project npm ERR! npm ERR! npm ERR! npm ERR! Fix the upstream dependency conflict, or retry npm ERR! npm ERR! this command with --force, or --legacy-peer-deps npm ERR! npm ERR! to accept an incorrect (and potentially broken) dependency resolution. npm ERR! npm ERR! npm ERR! npm ERR! See C:\Users\pa319k\AppData\Local\npm-cache\eresolve-report.txt for a full report. npm ERR! npm ERR! npm ERR! A complete log of this run can be found in: npm ERR! npm ERR! C:\Users\pa319k\AppData\Local\npm-cache_logs\2021-03-29T20_47_22_537Z-debug.log

npm ERR! A complete log of this run can be found in: npm ERR! C:\Users\pa319k\AppData\Local\npm-cache_logs\2021-03-29T20_47_23_334Z-debug.log

I have a very similar error. still no work around for me...

adams-family commented 3 years ago

+1

Same issue here :(

sbittmann commented 3 years ago

try npm install printer --legacy-peer-deps this worked for me on windows.

rqyrku commented 3 years ago

I still have this issue tried both npm install printer --legacy-peer-deps and export npm_config_legacy_peer_deps=true but with no success

Any suggestions?

k2s commented 3 years ago

I ended up using https://github.com/thiagoelg/node-printer

saknarak commented 1 year ago

this is worked for me (node 14-18)

npm install printer --build-from-source --legacy-peer-deps
ezno12 commented 1 year ago

try npm install printer --legacy-peer-deps this worked for me on windows.

worked for me too on windows

roicp commented 1 year ago

Thank you helped a lot