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 /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

1

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" }, 
2

My Script was written in ES6, I ran it threw Babel and then tried again and it worked perfectly!!

2

ncG1vNJzZmirpJawrLvVnqmfpJ%2Bse6S7zGiorp2jqbawutJobmlvYGmFc4GOqaKgZZaWtq2xw2arqGWdlrimecGyq56bn5my