zl程序教程

您现在的位置是:首页 >  后端

当前栏目

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

JSNode with your package tools INTO Applications
2023-09-14 09:00:47 时间

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