You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
For our Node server, we were actually running the process one directory up from the server, and calling node server/server.js, which meant that the bull-board express adapter was looking for the node_modules folder one level higher than where it actually existed (in ./node_modules instead of ./server/node_modules, and we got an error about
unknownErrorHandler Error: Failed to lookup view 'index.ejs' in views directory 'wrong/path/to/node_modules/@bull-board/ui/dist'
when attempting to view the bull-board UI, despite the file actually existing (just not at the path it was looking for).
Further description and possible solution:
I'd never seen this before in another NPM module, so i did some sleuthing, and found that path.resolve uses the CWD of the root process. Since we weren't running from the folder that contained node_modules, the ServerAdapter was getting thrown off.
Most other NPM modules I've seen use __dirname as the root of their path.resolve calls, in order to bypass any problems in finding the node_modules folder for an app by a more "absolute path" means.
Problem:
For our Node server, we were actually running the process one directory up from the server, and calling
node server/server.js
, which meant that the bull-board express adapter was looking for thenode_modules
folder one level higher than where it actually existed (in./node_modules
instead of./server/node_modules
, and we got an error aboutwhen attempting to view the bull-board UI, despite the file actually existing (just not at the path it was looking for).
Further description and possible solution:
I'd never seen this before in another NPM module, so i did some sleuthing, and found that
path.resolve
uses the CWD of the root process. Since we weren't running from the folder that containednode_modules
, the ServerAdapter was getting thrown off.Most other NPM modules I've seen use
__dirname
as the root of theirpath.resolve
calls, in order to bypass any problems in finding thenode_modules
folder for an app by a more "absolute path" means.The problem lies in https://github.com/felixmosh/bull-board/blob/master/packages/api/src/index.ts on lines 19 & 20 (e.g. the calls to
path.resolve()
).I'm not the most seasoned with Node.js, but the resource here: https://www.digitalocean.com/community/tutorials/nodejs-how-to-use__dirname seems to indicate that you'll get the directory for the API package's index.ts, at which point you could use relative paths to get to the rest of what you need?
Hope this helps.
The text was updated successfully, but these errors were encountered: