[Tools] Package Your node.js Projects Into a Standalone Applications with pkg

pkg allows you to take any of your node projects and bundle them up into standalone apps that you can ship to people or servers that do not have node.js installed. This lesson walks you through installing and using pkg on two simple projects.

 

Install:

npm i -g pkg

 https://www.npmjs.com/package/pkg

index.js:

console.log("hello world")

 

Run:

pkg index.js --target macos --output hello-wrold

 

It will output a bash file to run:

./hello-world

 

posted @ 2020-06-17 20:03  Zhentiw  阅读(140)  评论(0编辑  收藏  举报