vercel / pkg

Package your Node.js project into an executable
https://npmjs.com/pkg
MIT License
24.33k stars 1.02k forks source link

why the project example run "pkg .",the generate file execute with error #208

Closed junerleer closed 7 years ago

junerleer commented 7 years ago

Environment system:win 7 node:8.3.0

the error pic : error

igorklopov commented 7 years ago

Please run npm intsall before compilation

junerleer commented 7 years ago

thanks for your reply.

my real problem is I used the framework called thinkjs v2.2

the structure is as bellow --app/ code after babel --node_modules/
--www/ --www/production.js entry.js --www/static/ assets resources --view/ view templates --package.json

Real project is complex, so I use the thinkjs-cli create the easiest demo. Then I config the package.json and modified the entry.js.

--package.json-- "bin":"www/production.js", "pkg":{ "assets":["view/**/*","www/static/*"], "scripts":["app/*.js"] },

--production.js-- ` var thinkjs = require('thinkjs'); var path = require('path');

var rootPath = path.dirname(__dirname)

var instance = new thinkjs({ APP_PATH: path.join(rootPath,'app'), RUNTIME_PATH: path.join(rootPath,'runtime'), ROOT_PATH: rootPath, RESOURCE_PATH: path.join(rootPath,'www'), env: 'production' });

instance.run(true); ` I can generate the executable file successfully, but it stills run with error default

the test demo url is "https://github.com/junerleer/pkg_demo"

junerleer commented 7 years ago

@igorklopov I am confused about the snapshot,I really config the pkg options in package.json