-
Notifications
You must be signed in to change notification settings - Fork 1k
It seems that pkg is not compatible with Axios! #1936
Comments
Starting from axios 1.0.0 uses esm and pkg doesn't support them yet |
In my case, I try to downgrade axios from 1.3.4 to 0.27.2, it's ok. more info you can read issue641 |
Yes, I did it and it worked. But 0.27.2 is too old. |
compile the javascript first using ncc before using pkg. "scripts": { |
* Stick axios to version < 1.0.0 because it's ESM and pkg doesn't support it yet. vercel/pkg#1936 * For now, ts-node is not compatible with typescript 5 * replace pretty-quick with lint-staged
so the solution to make pkg work here is to downgrade axios to 0.27.2? or is there any update? |
Nope. ESM support likely to never come: yao-pkg#5 (comment) |
In order to use axios latest just add this to your scripts in package.json:
|
we solved the problem taking the CommonJS library from axios/dist ( *.cjs and *.cjs.map files) under a "lib" directory under the project root files, and requiring the axios library from there instead of using the usual require, later on removing the "axios" package from the project. This workaround solved our issue... we are working with node 18.18.0 and pkg node 18.5 (think is the latest supported?) |
Last supported is v20: https://github.com/yao-pkg/pkg |
What version of pkg are you using?
5.8.1
What version of Node.js are you using?
18.15.0
What operating system are you using?
Windows
What CPU architecture are you using?
x64
What Node versions, OSs and CPU architectures are you building for?
node18-win-x64
Describe the Bug
There is Axios module in my NodeJS source code as a required module. Whenever I try to export Node code as an exe file by:
pkg app.js --update-base --targets node18-win-x64
It does its job but by the below warnings printed on PowerShell:
In first, I tried pkg by the latest version of axios but after that I downgraded axios previous versions.
Expected Behavior
The exe file created without any warning about axios module.
To Reproduce
Trying this command on PowerShell:
pkg app.js --update-base --targets node18-win-x64
The text was updated successfully, but these errors were encountered: