Pkg Failed to Make Bytecode
I Am Getting This Warning When I Try and Run. . Pkg Index. Js -T macOS Node V17.3.1 [Email Protected] Warning Failed to Make Bytecode Node17-Arm64 for File...
I am getting this warning when I try and run .. pkg index.js -t macOS
node v17.3.1 [email protected]
Warning Failed to make bytecode node17-arm64 for file /snapshot/______/index.js
was hoping anyone could help,
I have also tried to use -b and got
Error: ENOENT: no such file or directory, open '/var/folders/fy/c5tgsjcj63q73kfvg_dd53fh0000gn/T/pkg.d5ef9dd92b18360a4ff95824/node/out/Release/node
thank you
2 Answers
I used @vercel/ncc to generate one index.js file and then use pkg on the generated index.js file.
My package.json scripts is like this:
"scripts": {
"test": "jest",
"start": "node src/index.js",
"dev": "nodemon src/index.js",
"build": "ncc build -o build/lib ./src/index.js && pkg --target node16-win-x64 -o build/MY-API.exe ./build/lib/index.js"
},
My Script was written in ES6, I ran it threw Babel and then tried again and it worked perfectly!!