Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error: Cannot find module 'ejs' #297

Closed
lukepolo opened this issue Jun 15, 2021 · 8 comments
Closed

Error: Cannot find module 'ejs' #297

lukepolo opened this issue Jun 15, 2021 · 8 comments

Comments

@lukepolo
Copy link

When building for production and running, we run into an issue that it cannot find the ejs.

It seems relevant to : expressjs/express#910

I think I will also have an issue with the static assets path (I can by copying over the static assets, but not the paths)

A simple test is to use webpack , do a build , copy the dist to a folder and try running it. (It should fail)

@felixmosh
Copy link
Owner

felixmosh commented Jun 15, 2021

Can you elaborate on your setup / versions?

@lukepolo
Copy link
Author

I’ll make a repo here tmw

@lukepolo
Copy link
Author

Here is a test repository

https://github.com/lukepolo/bull-board-build-bug

@lukepolo
Copy link
Author

I was able to get it to work by adding

app.engine('ejs', require('ejs').__express);

function createBullBoard(bullQueues) {
    const bullBoardQueues = new Map();
    const app = express_1.default();
    app.locals.bullBoardQueues = bullBoardQueues;
    app.set('view engine', 'ejs');
    app.engine('ejs', require('ejs').__express);
    app.set('views', path_1.default.resolve(__dirname, '../dist/ui'));
    app.use('/static', express_1.default.static(path_1.default.resolve(__dirname, '../static')));
    app.get(['/', '/queue/:queueName'], entryPoint_1.entryPoint);

I was going to go change it , but master seems to be pretty different than the latest version published on NPM

@felixmosh
Copy link
Owner

felixmosh commented Jun 16, 2021

I don't see any code that uses bull-board in your example.

You can make a PR against the latest v2, or try the version ;)

@felixmosh
Copy link
Owner

felixmosh commented Jun 20, 2021

I've fixed it at v3.2.9

Thank you for the fix 🙏🏼

Try it :]

@lukepolo
Copy link
Author

Oh snap! Your awesome!!!

@lukepolo
Copy link
Author

It worked!!!! Even moving it to a different folder. Great work. thanks!!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants