Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

nodejs pkg - property 'bin' does not exist in package.json

Tags:

node.js

npm

i'm using PKG to build a program using package.json. I included the "pkg" property in package.json but pkg always returns Error! Property 'bin' does not exist in [path to package.json]

when i add the bin property it asks for the directory for the path to bin, i tried giving it the path the .bin folder in node_modules (which does make the error go away), however the generated executable just crashes immidiatley with no error. I havent found this error anywhere else.

like image 771
KCGD Avatar asked Apr 18 '26 08:04

KCGD


1 Answers

Setting the property "bin" to "./main.js" (the program's entrypoint) seems to have fixed the problem. package.json:

{
  "name": "project-name",
  "version": "1.0.0",
  "description": "",
  "main": "./main.js",
  "bin": "./main.js",
  "scripts": {
    "start": "node ."
  }
}
like image 179
KCGD Avatar answered Apr 20 '26 23:04

KCGD



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!