tojocky / node-printer

Native node.js printer
1.51k stars 436 forks source link

Cant install npm install printer. #333

Open Abe-Telo opened 6 months ago

Abe-Telo commented 6 months ago

on a windows platform when i do npm install printer. I am getting this issue.


npm install printer
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated node-pre-gyp@0.14.0: Please upgrade to https://github.com/mapbox/node-pre-gyp: the non-scoped node-pre-gyp package is deprecated and only the @mapbox scoped package will recieve updates in the future
npm ERR! code 4294963238
npm ERR! path C:\Users\user\Downloads\Tracking Package\package_tracking_app\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 ENOENT
npm ERR! npm ERR! syscall spawn git
npm ERR! npm ERR! path git
npm ERR! npm ERR! errno -4058
npm ERR! npm ERR! enoent An unknown git error occurred
npm ERR! npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! npm ERR! enoent
npm ERR!
npm ERR! npm ERR! A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2023-12-12T14_21_09_065Z-debug-0.log

npm ERR! A complete log of this run can be found in: C:\Users\user\AppData\Local\npm-cache_logs\2023-12-12T14_20_50_343Z-debug-0.log
Abe-Telo commented 6 months ago

Update. I finally passed the stage when i ran the CMD in administrator mode. With other commands that i ran to resolve it, but i now i get this error and wondering if this does not work in 64bit Windows?


node:internal/modules/cjs/loader:1473
  return process.dlopen(module, path.toNamespacedPath(filename));
                 ^

Error: \\?\C:\Users\user\Downloads\Tracking Package\package_tracking_app\node_modules\printer\lib\node_printer.node is not a valid Win32 application.
\\?\C:\Users\user\Downloads\Tracking Package\package_tracking_app\node_modules\printer\lib\node_printer.node
    at Module._extensions..node (node:internal/modules/cjs/loader:1473:18)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12)
    at Module.require (node:internal/modules/cjs/loader:1235:19)
    at require (node:internal/modules/helpers:176:18)
    at Object.<anonymous> (C:\Users\user\Downloads\Tracking Package\package_tracking_app\node_modules\printer\lib\printer.js:10:22)
    at Module._compile (node:internal/modules/cjs/loader:1376:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1435:10)
    at Module.load (node:internal/modules/cjs/loader:1207:32)
    at Module._load (node:internal/modules/cjs/loader:1023:12) {
  code: 'ERR_DLOPEN_FAILED'
}

Node.js v20.10.0
Abe-Telo commented 6 months ago

Actually, I see that there are so many versions of this on Git Hub. so let me go down to basics.

What version or command do i use to install this on a Windows 10 64 BIT PC for a CITIZEN CL-E300 DT PRINTER?

Using the latest node.js v20.10.0 dot net 6.0.203 Visual Studio 2019 (my other Deployment computer has 2022 i think or 2019?) node-pre-gyp@0.17.0 node-gyp@10.0.1 python@0.0.4

If there is anything i need to update, Or if i need to use a particle link to get this working, please let me know.

geoff8888 commented 5 months ago

I'm stuck with the same issue.

After running

npm install printer

in Windows 11 64 bit, I got the same error message

npm ERR! npm ERR! enoent This is related to npm not being able to find a file.

I could not continue after this.

greenlife-developer commented 3 months ago

Is there a solution to this?? I want to use it because it is Linux compactible. I have used pdf-to-printer for this same purpose, but while that one worked offline, it failed on render server. But the docs says this is Linux compactible, but how is there issue installing the module, has anyone installed it?

Sheryoo commented 3 months ago

I have the same issue on Mac and can't handle it even after adding the --force flag to "npm install ...."

Lucgecko commented 3 months ago

Still having the same issue.

Sasao4o commented 2 months ago

Still having the same issue.

arnolddozsa commented 2 months ago

If somebody struggling with installation or building. I am using Linux x64. gyp problems solved by npm install node-gyp --legacy-peer-deps build problems solved by following Rebuild failed because i have only python3 on my system and error gave this

No such file or directory: 'python' while executing command '['python', 'tools/getSourceFiles.py', 'src', 'cc']' in binding.gyp while trying to load binding.gyp gyp ERR! configure error gyp ERR! stack Error: gyp failed with exit code: 1 gyp ERR! stack at ChildProcess. (/usr/lib/node_modules/node-gyp/lib/configure.js:297:18) gyp ERR! stack at ChildProcess.emit (node:events:514:28) gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:291:12) gyp ERR! System Linux 5.15.0-76-generic gyp ERR! command "/usr/bin/node" "/usr/bin/node-gyp" "rebuild" "--legacy-peer-deps" gyp ERR! cwd /var/www/nubes/node_modules/@mhzq/nubespdf/node_modules/printer gyp ERR! node -v v18.17.1 gyp ERR! node-gyp -v v10.1.0 gyp ERR! not ok

so i decidet to go and edit node_modules/printer/binding.gyp and changed line 23 '<!@(["python", "tools/getSourceFiles.py", "src", "cc"])' to '<!@(["python3", "tools/getSourceFiles.py", "src", "cc"])'

and finally build was successful!!

hope this helps others who has linux too