Reputation: 3566
I have a simple cli node script that I want to pack using pkg
.
I've tried with the following command
host:~ dev$ pkg /Users/dev/Desktop/myscript/ --target node14-macos-x64 node14-linux-x64 node14-win-x64
unfortunately I will get this error in terminal
> [email protected]
> Error! Not more than one entry file/directory is expected
If I try to remove the target instead, I will get this other error in terminal
> [email protected]
> Targets not specified. Assuming:
node15-linux-x64, node15-macos-x64, node15-win-x64
> Error! No available node version satisfies 'node15'
In my system I'm running node v15.4.0 so I can't understand what's wrong.
My project package.json file looks like:
{
"name": "myscript",
"version": "1.3.0",
"bin": "index.js",
"dependencies": {
"chalk": "^4.1.0",
"commander": "^7.1.0",
"dotenv": "^8.2.0",
"facebook-chat-api": "^1.8.0",
"forever-monitor": "^3.0.3",
"node-notifier": "^9.0.0"
}
}
How I can pack my app and fix these problems?
Upvotes: 0
Views: 4221
Reputation: 569
Seems like you're missing an s
: use --targets
instead of --target
pkg can generate executables for several target machines at a time. You can specify a comma-separated list of targets via --targets
https://www.npmjs.com/package/pkg
Upvotes: 2