-
Notifications
You must be signed in to change notification settings - Fork 1k
Error: Cannot find module 'pug' #398
Comments
How are you requiring pug? |
anyone has solved this issue ?? |
It would help to see some code. |
@HardlyMirage i have done the same, if you create an express app from the express generator, you will have a "View" folder with some files having the extension ".pug"; example: "index.pug"... the thing is, in zeit pkg, we arent able to include modules in the binary file( .exe). |
I cloned a starter kit: https://www.npmjs.com/package/express-pug-starter Added Without seeing your code, I cannot help you. |
Just tested with express generator as well.
The application runs just fine on port 3000. |
@HardlyMirage I will test it later on today and will let you know if that works for ubuntu :) |
@kounelios13 Eazy, the solution to this would be: in package.json add
make sure you add main and bin and the script "build-package" and the "pkg" referencing the views folder(which holds the pug templates). next, add in your app.js right before There we are not depending on "www" file to host our app. and finally, to get an executable of your app, simple type in the command:
Please feel free to ask any question. Thanks. |
Do you have Pug installed? |
Seems to have been answered |
Hello.I generated an express-app using the express-generator and specified its view to be pug.Now I want to package it using the following command:
pkg ./bin/www
.This generates the executable files for each platform.However when I try to run my app and load my server through the browser I get the following error:Here is my
package.json
:`
{
"name": "work-calendar",
"version": "0.0.0",
"private": true,
"scripts": {
"start": "node ./bin/www",
"help": "pkg --help",
"package-linux": "pkg .-t latest-linux-x64 -o ./app ./app.js",
"p-all": "pkg ./bin/www",
"p-win":"pkg . -t node8-win-x64"
},
"dependencies": {
"body-parser": "~1.18.2",
"cookie-parser": "~1.4.3",
"debug": "~2.6.9",
"express": "~4.15.5",
"morgan": "~1.9.0",
"pug": "2.0.0-beta11",
"serve-favicon": "~2.4.5"
},
"pkg": {
"assets": "views/**/*"
},
"devDependencies": {
"pkg": "^4.3.1"
}
}
`
Any ideas how can I resolve it?
The text was updated successfully, but these errors were encountered: