[Bug]: Error: Cannot find module './dev' when built from source #1277

Closed
opened 2026-04-24 23:38:08 +02:00 by adam · 2 comments
Owner

Originally created by @nephaste on GitHub (Jul 22, 2023).

Describe the issue

Hi team, thanks for this software, I am trying to build from Source, but drop on error and start

image

I used reverse enginnering from the dockerfile to build

Steps to reproduce the issue

  1. grab Nodejs16

mkdir -p /opt/Audiobookshelf
cd /opt/Audiobookshelf

curl -L https://nodejs.org/dist/latest-v16.x/node-v16.20.1-linux-x64.tar.gz | tar zxvf - --strip-components 1

export PATH=/opt/Audiobookshelf/bin:$PATH

  1. build dep software

#build nuxt
/opt/Audiobookshelf/bin/npm install -g nuxt --prefix /opt/Audiobookshelf/
#build tone
/opt/Audiobookshelf/bin/npm install -g tone --prefix /opt/Audiobookshelf/

  1. grap from github

git clone --recursive https://github.com/advplyr/audiobookshelf
cd audiobookshelf

  1. start compilation

cd client

/opt/Audiobookshelf/bin/npm ci && /opt/Audiobookshelf/bin/npm cache clean --force
/opt/Audiobookshelf/bin/npm run generate

cd ..

export NODE_ENV=production

../bin/npm ci --only=production

all compile fine...

but start node index.js fall on Error: Cannot find module './dev'

image

What I am missing ?

Audiobookshelf version

3.2.3 (master git)

How are you running audiobookshelf?

Built from source

Originally created by @nephaste on GitHub (Jul 22, 2023). ### Describe the issue Hi team, thanks for this software, I am trying to build from Source, but drop on error and start ![image](https://github.com/advplyr/audiobookshelf/assets/3392684/3ab178f3-8e4e-4241-8914-2148c2205438) I used reverse enginnering from the dockerfile to build ### Steps to reproduce the issue 1. grab Nodejs16 mkdir -p /opt/Audiobookshelf cd /opt/Audiobookshelf curl -L https://nodejs.org/dist/latest-v16.x/node-v16.20.1-linux-x64.tar.gz | tar zxvf - --strip-components 1 export PATH=/opt/Audiobookshelf/bin:$PATH 2. build dep software #build nuxt /opt/Audiobookshelf/bin/npm install -g nuxt --prefix /opt/Audiobookshelf/ #build tone /opt/Audiobookshelf/bin/npm install -g tone --prefix /opt/Audiobookshelf/ 3. grap from github git clone --recursive https://github.com/advplyr/audiobookshelf cd audiobookshelf 4. start compilation cd client /opt/Audiobookshelf/bin/npm ci && /opt/Audiobookshelf/bin/npm cache clean --force /opt/Audiobookshelf/bin/npm run generate cd .. export NODE_ENV=production ../bin/npm ci --only=production all compile fine... but start node index.js fall on Error: Cannot find module './dev' ![image](https://github.com/advplyr/audiobookshelf/assets/3392684/6ef09258-13f4-47f1-8fe0-63667fa3d0c3) What I am missing ? ### Audiobookshelf version 3.2.3 (master git) ### How are you running audiobookshelf? Built from source
adam added the bug label 2026-04-24 23:38:08 +02:00
adam closed this issue 2026-04-24 23:38:08 +02:00
Author
Owner

@advplyr commented on GitHub (Jul 22, 2023):

export NODE_ENV=production this line isn't actually setting the NODE_ENV before you are doing node index.js

node index.js is going to first check if NODE_ENV is to production, if it is not set to production it will expect to find a file called dev.js used for development.

Double check how you can set env variables for your OS and set it right before calling node index.js

@advplyr commented on GitHub (Jul 22, 2023): `export NODE_ENV=production` this line isn't actually setting the NODE_ENV before you are doing `node index.js` `node index.js` is going to first check if `NODE_ENV` is to production, if it is not set to production it will expect to find a file called `dev.js` used for development. Double check how you can set env variables for your OS and set it right before calling `node index.js`
Author
Owner

@nephaste commented on GitHub (Jul 22, 2023):

Works great .... thanks a lot from all Qnap NAS community

@nephaste commented on GitHub (Jul 22, 2023): Works great .... thanks a lot from all Qnap NAS community
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: starred/audiobookshelf#1277