Uberspace / lab

The Uberlab provides various tutorials - written by you! - on how to run software and tools on Uberspace 7.
https://lab.uberspace.de
Other
316 stars 417 forks source link

[xBrowserSync API] running fails with error "Cannot find module 'bunyan'" #1501

Closed korakinos closed 1 year ago

korakinos commented 1 year ago

After installing the xBrowserSync API according to the guide (using the latest release 1.1.13; the guide refers to 1.1.18 in some places, which I reckon is a typo for 1.1.8), running the created service via supervisorctl fails with no clear error. Running the command node /home/xbs/xbrowsersync/api/dist/api.js from the service file manually gives the following error output:

$ node /home/xbs/xbrowsersync/api/dist/api.js 
node:internal/modules/cjs/loader:1078
  throw err;
  ^

Error: Cannot find module 'bunyan'
Require stack:
- /home/xbs/xbrowsersync/api/dist/server.js
- /home/xbs/xbrowsersync/api/dist/api.js
    at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
    at Module._load (node:internal/modules/cjs/loader:920:27)
    at Module.require (node:internal/modules/cjs/loader:1141:19)
    at require (node:internal/modules/cjs/helpers:110:18)
    at Object.<anonymous> (/home/xbs/xbrowsersync/api/dist/server.js:26:34)
    at Module._compile (node:internal/modules/cjs/loader:1254:14)
    at Module._extensions..js (node:internal/modules/cjs/loader:1308:10)
    at Module.load (node:internal/modules/cjs/loader:1117:32)
    at Module._load (node:internal/modules/cjs/loader:958:12)
    at Module.require (node:internal/modules/cjs/loader:1141:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/home/xbs/xbrowsersync/api/dist/server.js',
    '/home/xbs/xbrowsersync/api/dist/api.js'
  ]
}

Node.js v18.14.1

This appears to be the exact same bug as https://github.com/xbrowsersync/api/issues/81. Like reported there, running npm install bunyan does not help.

sunflower-seed commented 1 year ago

You need an older version of node. As i remember i tested it with Version 12.

If you need a newer version of node for another parallel application you can work it around (not suggested) by accessing node directly /opt/nodejs12/bin/node

In general node 12 is supported only for a few further months. And there is sadly not much progress in the project.

See also: https://github.com/xbrowsersync/app/issues/425

korakinos commented 1 year ago

Thanks, that must be it! I totally missed the bit about the node version in the guide.

I did not try again with version 12, because I have meanwhile lost my second device, so I have no need for browser synchronisation anymore. I'm closing this issue anyway.