Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

princexml wasn't found in path #52

Open
GetPsyched opened this issue Oct 8, 2023 · 7 comments
Open

princexml wasn't found in path #52

GetPsyched opened this issue Oct 8, 2023 · 7 comments

Comments

@GetPsyched
Copy link

GetPsyched commented Oct 8, 2023

When I run my application that uses node-prince as a dependency, it errors out saying Error: Prince#execute: cannot resolve binary "prince" to a filesystem path

Full error:

Error: Prince#execute: cannot resolve binary "prince" to a filesystem path
    at Prince._execute (/home/getpsyched/git/printer/node_modules/prince/prince-api.js:292:19)
    at Prince.execute (/home/getpsyched/git/printer/node_modules/prince/prince-api.js:359:17)
    at generatePDF (file:///home/getpsyched/git/printer/build/server/chunks/generate-012b0792.js:30:106)
    at async POST (file:///home/getpsyched/git/printer/build/server/chunks/_server.ts-b6de181a.js:8:15)
    at async render_endpoint (file:///home/getpsyched/git/printer/build/server/index.js:1575:20)
    at async resolve (file:///home/getpsyched/git/printer/build/server/index.js:4002:22)
    at async respond (file:///home/getpsyched/git/printer/build/server/index.js:3891:22)
    at async Array.ssr (file:///home/getpsyched/git/printer/build/handler.js:1221:3)
@GetPsyched
Copy link
Author

I am on NixOS

@rse
Copy link
Owner

rse commented Oct 8, 2023

Well, it means that "prince" is not in $PATH and that node-prince was also unable to determine that NixOS is a Linux environment. So, either you have to install PrinceXML manually into the system before using node-prince or we have to figure out what check is needed to recognize NixOS in https://github.com/rse/node-prince/blob/master/prince-npm.js

@GetPsyched
Copy link
Author

GetPsyched commented Oct 9, 2023

I have installed PrinceXML manually on my system but I was having issues doing the same on the deployed instance of my application (which also runs it on NixOS AFAIK).

or we have to figure out what check is needed to recognize NixOS in https://github.com/rse/node-prince/blob/master/prince-npm.js

How can I help with that? I'm willing to do some debugging if you wish.

@GetPsyched
Copy link
Author

I just cloned this repo and ran npm install. Here's the logs:
image

It actually does detect NixOS as a Linux environment and chooses the correct package. But it does not do this when using node-prince as a dependency.

@GetPsyched
Copy link
Author

@rse any comment?

@rse
Copy link
Owner

rse commented Nov 10, 2023

I've tried it out: I've created a package.json with a dependency to "prince" and then have run...

npm --loglevel=silly i --foreground-scripts

...(with NPM 10.2.3) and the "install" script was correctly executed inside the "prince" package (it downloaded PrinceXML and unpacked it). So, perhaps it is an issue with your particular/older NPM version?

@GetPsyched
Copy link
Author

GetPsyched commented Nov 13, 2023

I'm getting a new error after updating prince to 1.11.1:

Error: {"error":{"errno":-2,"code":"ENOENT","syscall":"spawn /home/getpsyched/git/printer/node_modules/prince/prince/lib/prince/bin/prince","path":"/home/getpsyched/git/printer/node_modules/prince/prince/lib/prince/bin/prince","spawnargs":["--prefix","/home/getpsyched/git/printer/node_modules/prince/prince/lib/prince","dist/question-paper.html","--output","dist/output.pdf"],"cmd":"/home/getpsyched/git/printer/node_modules/prince/prince/lib/prince/bin/prince --prefix /home/getpsyched/git/printer/node_modules/prince/prince/lib/prince dist/question-paper.html --output dist/output.pdf"},"stdout":{"type":"Buffer","data":[]},"stderr":{"type":"Buffer","data":[]}}
    at Module.coalesce_to_error (/home/getpsyched/git/printer/node_modules/@sveltejs/kit/src/utils/error.js:9:5)
    at Module.handle_fatal_error (/home/getpsyched/git/printer/node_modules/@sveltejs/kit/src/runtime/server/utils.js:72:47)
    at resolve (/home/getpsyched/git/printer/node_modules/@sveltejs/kit/src/runtime/server/respond.js:500:17)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async Module.respond (/home/getpsyched/git/printer/node_modules/@sveltejs/kit/src/runtime/server/respond.js:274:20)
    at async file:///home/getpsyched/git/printer/node_modules/@sveltejs/kit/src/exports/vite/dev/index.js:510:22

Note that I do find the binary installed by the lib at the relative path: node_modules/prince/prince/lib/prince/bin/prince

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants