I have an application in node.js and now I'm trying to create a executable to run the application without all project files but I'm having problems when I try use pkg
(https://github.com/zeit/pkg#detecting-assets-in-source-code).
In package.json
I add this:
"pkg": {
"scripts": "public/js/*.js",
"assets": [
"views/**/*"
],
"targets": "node6"
},
In console I run this command and I don't have any error in this process and create 3 platforms executable, pkg index.js --output
When I run the executable It starts with no errors and when I access to browser it returns me this error:
Error: Failed to lookup view "login" in views directory "/snapshot/Picking/views"
at EventEmitter.render (/snapshot/Picking/node_modules/express/lib/application.js:580:17)
at ServerResponse.render (/snapshot/Picking/node_modules/express/lib/response.js:1008:7)
at ServerResponse.app.use.res.render (/snapshot/Picking/index.js:0)
at index (/snapshot/Picking/controllers/loginController.js:0)
at Layer.handle [as handle_request] (/snapshot/Picking/node_modules/express/lib/router/layer.js:95:5)
at next (/snapshot/Picking/node_modules/express/lib/router/route.js:137:13)
at Route.dispatch (/snapshot/Picking/node_modules/express/lib/router/route.js:112:3)
at Layer.handle [as handle_request] (/snapshot/Picking/node_modules/express/lib/router/layer.js:95:5)
at /snapshot/Picking/node_modules/express/lib/router/index.js:281:22
at Function.process_params (/snapshot/Picking/node_modules/express/lib/router/index.js:335:12)
In index.js I have this line to access views folder:
app.set("views", path.join(__dirname, 'views'));
How can I solve this situation?
Thank you