Skip to content

node dist/api.js fails with "cannot find module bunyan" #81

Description

@AumCoin

Debian 11, fresh out of the box. I follow directions and and when I get to node dist/api.js it fails with the error below. The same is true whether I run as root or a normal user. I have tried various directions on the internet to install bunyan with --save or globally, but this did not affect the result. I have been through your directions multiple times. Please tell me how to resolve this error.

root@xbrowsersync:/home/rick/api# node dist/api.js
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'bunyan'
Require stack:
- /home/rick/api/dist/server.js
- /home/rick/api/dist/api.js
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/home/rick/api/dist/server.js:26:34)
    at Module._compile (node:internal/modules/cjs/loader:1105:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1159:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [ '/home/rick/api/dist/server.js', '/home/rick/api/dist/api.js' ]
}

Activity

  1. AumCoin commented on Jul 23, 2022

    @AumCoin
    Author

    Gave up in frustration after spending half a day on this and tried docker-compose by following the directions, then I installed the Firefox client. I click "switch service" and enter the hostname from my .env file. First I was using an IP address, then I switched the .env file to hostname and tried that in the client. In both cases it immediately tells me it cannot connect. I have no firewall enabled. I can ping the hostname from the docker host and elsewhere. Why isn't this hostname working with the Firefox client?

    docker-compose ps:

          Name                     Command                  State                             Ports                       
    ----------------------------------------------------------------------------------------------------------------------
    xbs-api             docker-entrypoint.sh node  ...   Up (healthy)   8080/tcp                                          
    xbs-db              docker-entrypoint.sh mongod      Up             27017/tcp                                         
    xbs-reverse-proxy   caddy reverse-proxy --from ...   Up             2019/tcp, 0.0.0.0:443->443/tcp, 0.0.0.0:80->80/tcp
    

    docker-compose top

    xbs-api
    UID    PID    PPID   C   STIME   TTY     TIME           CMD       
    ------------------------------------------------------------------
    root   5562   5543   0   20:29   ?     00:00:01   node dist/api.js
    
    xbs-db
      UID      PID    PPID   C   STIME   TTY     TIME                 CMD            
    ---------------------------------------------------------------------------------
    systemd+   5464   5445   1   20:29   ?     00:00:03   mongod --auth --bind_ip_all
    
    xbs-reverse-proxy
    UID    PID    PPID   C   STIME   TTY     TIME                                CMD                           
    -----------------------------------------------------------------------------------------------------------
    root   5680   5661   0   20:29   ?     00:00:00   caddy reverse-proxy --from xbrowsersync.lan --to api:8080
    

    It is not possible to connect to http://xbrowsersync.lan or https://xbrowsersync.lan from the client.

    Not claiming to be an expert in any of the technologies used, just following the exact directions on your website for docker-compose, after the manual directions outright failed.

  2. nero120 commented on Jul 23, 2022

    @nero120
    Member

    You have a missing dependency (bunyan), could be for a myriad of reasons. Go read up on Node.js.

  3. vdias commented on Feb 22, 2023

    @vdias

    Same error even after install the module...

    "npm install bunyan" finish without error... but still got the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions