question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Error: Cannot find module '/var/www/start' in Docker - Windows 10 / Windows Server

See original GitHub issue

Current behaviour

When booting the vue-storefront-app service using docker on Windows 10 Professional Edition. The PM2 service will result in an error if you configure the NODE_ENV from β€œdev” to β€œproduction” (further explanation can be found below in the Additional Information section) which will result in the following error across all PM2 instances: β€œError: Cannot find module β€˜/var/www/start’”

After it phases through the docker configuration and setup via docker. These are the logs:

PM2 boots the 4 instances successfully, but then soon after encounters, an error: β€œError: Cannot find module β€˜/var/www/start’”. View logs for more information ──────────┬────┬─────────┬─────┬────────┬─────────┬────────┬──────┬───────────┬──────┬──────────┐

β”‚ App name β”‚ id β”‚ mode β”‚ pid β”‚ status β”‚ restart β”‚ uptime β”‚ cpu β”‚ mem β”‚ user β”‚ watching β”‚

β”œβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”Όβ”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€

β”‚ server β”‚ 0 β”‚ cluster β”‚ 247 β”‚ online β”‚ 0 β”‚ 0s β”‚ 131% β”‚ 74.7 MB β”‚ root β”‚ disabled β”‚

β”‚ server β”‚ 1 β”‚ cluster β”‚ 254 β”‚ online β”‚ 0 β”‚ 0s β”‚ 100% β”‚ 62.7 MB β”‚ root β”‚ disabled β”‚

β”‚ server β”‚ 2 β”‚ cluster β”‚ 265 β”‚ online β”‚ 0 β”‚ 0s β”‚ 104% β”‚ 37.1 MB β”‚ root β”‚ disabled β”‚

β”‚ server β”‚ 3 β”‚ cluster β”‚ 276 β”‚ online β”‚ 0 β”‚ 0s β”‚ 93% β”‚ 30.9 MB β”‚ root β”‚ disabled β”‚

β””β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”΄β”€β”€β”€β”€β”€β”€β”€β”€β”€β”€β”˜

[2020-05-24 04:24:58] PM2 log: Use pm2 show <id|name> to get more details about an app

[2020-05-24 04:24:58] PM2 log: [–no-daemon] Continue to stream logs

[2020-05-24 04:24:58] PM2 log: [–no-daemon] Exit on target PM2 exit pid=236

04:24:58 0|server | Error: Cannot find module β€˜/var/www/start’

04:24:58 0|server | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

04:24:58 0|server | at Function.Module._load (internal/modules/cjs/loader.js:562:25)

04:24:58 0|server | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

04:24:58 0|server | at main (/var/www/node_modules/ts-node/src/bin.ts:226:14)

04:24:58 0|server | at Object.<anonymous> (/var/www/node_modules/ts-node/src/bin.ts:485:3)

04:24:58 0|server | at Module._compile (internal/modules/cjs/loader.js:778:30)

04:24:58 0|server | at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)

04:24:58 0|server | at Module.load (internal/modules/cjs/loader.js:653:32)

04:24:58 0|server | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

04:24:58 0|server | at Function.Module._load (internal/modules/cjs/loader.js:585:3)

04:24:58 1|server | Error: Cannot find module β€˜/var/www/start’

04:24:58 1|server | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

04:24:58 1|server | at Function.Module._load (internal/modules/cjs/loader.js:562:25)

04:24:58 1|server | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

04:24:58 1|server | at main (/var/www/node_modules/ts-node/src/bin.ts:226:14)

04:24:58 1|server | at Object.<anonymous> (/var/www/node_modules/ts-node/src/bin.ts:485:3)

04:24:58 1|server | at Module._compile (internal/modules/cjs/loader.js:778:30)

04:24:58 1|server | at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)

04:24:58 1|server | at Module.load (internal/modules/cjs/loader.js:653:32)

04:24:58 1|server | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

04:24:58 1|server | at Function.Module._load (internal/modules/cjs/loader.js:585:3)

04:24:59 2|server | Error: Cannot find module β€˜/var/www/start’

04:24:59 2|server | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

04:24:59 2|server | at Function.Module._load (internal/modules/cjs/loader.js:562:25)

04:24:59 2|server | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

04:24:59 2|server | at main (/var/www/node_modules/ts-node/src/bin.ts:226:14)

04:24:59 2|server | at Object.<anonymous> (/var/www/node_modules/ts-node/src/bin.ts:485:3)

04:24:59 2|server | at Module._compile (internal/modules/cjs/loader.js:778:30)

04:24:59 2|server | at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)

04:24:59 2|server | at Module.load (internal/modules/cjs/loader.js:653:32)

04:24:59 2|server | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

04:24:59 2|server | at Function.Module._load (internal/modules/cjs/loader.js:585:3)

04:24:59 3|server | Error: Cannot find module β€˜/var/www/start’

04:24:59 3|server | at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)

04:24:59 3|server | at Function.Module._load (internal/modules/cjs/loader.js:562:25)

04:24:59 3|server | at Function.Module.runMain (internal/modules/cjs/loader.js:831:12)

04:24:59 3|server | at main (/var/www/node_modules/ts-node/src/bin.ts:226:14)

04:24:59 3|server | at Object.<anonymous> (/var/www/node_modules/ts-node/src/bin.ts:485:3)

04:24:59 3|server | at Module._compile (internal/modules/cjs/loader.js:778:30)

04:24:59 3|server | at Object.Module._extensions…js (internal/modules/cjs/loader.js:789:10)

04:24:59 3|server | at Module.load (internal/modules/cjs/loader.js:653:32)

04:24:59 3|server | at tryModuleLoad (internal/modules/cjs/loader.js:593:12)

04:24:59 3|server | at Function.Module._load (internal/modules/cjs/loader.js:585:3)

Expected behaviour

The service should boot and users should be able to connect to localhost:3000 or 0.0.0.0:3000 to see the vue-frontend.

Steps to reproduce the issue

  • By default the Repository has been configured so that the vue-frontend runs in DEV mode, therefore if you need to replace the key word: β€œdev” to β€œproduction” in the docker file and the docker-compose files - can then execute β€œdocker-compose up -d” to build the docker image.

  • Currently: this hasn’t been configured to run on a windows platform (including my windows 2019 servers).

Can you handle fixing this bug by yourself?

  • [ X ] NO

Which Release Cycle state this refers to? Info for developer.

Pick one option.

  • [ X ] This is a bug report for current Stable version on https://demo.storefrontcloud.io and should be placed in next stable version hotfix - In this case Developer should create a branch from hotfix or master branch and create Pull Request 4. Hotfix back to hotfix.

Environment details

Additional information

  • The current version of vue-frontend works perfectly fine if you don’t change the NODE_ENV settings from β€œdev” to β€œproduction” in the docker file and the docker-compose files. The repository itself defaults back to β€œyarn dev” due to the shell file (vue-frontend.sh) when you execute β€œyarn start” / β€œnpm start”.

  • By default when directly downloaded from the repository https://github.com/DivanteLtd/vue-storefront - β€œyarn start” is the equivalent of β€œyarn dev” .

  • As vue-storefront caches the vue-storefront interface. When testing this issue please use a fresh incognito mode page. (Don’t be tricked by the cached version from the previous dev build).

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:10 (1 by maintainers)

github_iconTop GitHub Comments

1reaction
janimaljanencommented, May 25, 2020

Had the same issue, resolved by fixing ecosystem.json as mentioned in: https://github.com/DivanteLtd/vue-storefront/issues/4191#issuecomment-602535658

0reactions
ShiftyCosmiicommented, Aug 29, 2020

I have the same issue but in kubernetes pods . The cmd β€œyarn start” works fine in linux machine and macOs but not inside the pods , showing this error β€œError: Cannot find module β€˜/var/www/start’” . Any idea how to fix it please ?

Have you made sure to run β€œyarn build” before running β€œyarn start”. Yarn start requires the build files that are created in var/www/.

It is an honest mistake, but I’m pretty sure that is your issue

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Cannot find module '/var/www/start' in Docker - Windows ...
Current behaviour When booting the vue-storefront-app service using docker on Windows 10 Professional Edition. The PM2 service will resultΒ ...
Read more >
Cannot find module for a node js app running in a docker ...
The common way is to create a Dockerfile that is already aware of your application, and make it copy your package.json file and...
Read more >
Dockerized Node.js app Error: cannot find module - Compose
When I start a dockerized Node.js testapp with sudo docker-compose up. I get the following error: Starting testapp_web_1 ... done AttachingΒ ...
Read more >
Newbie in Docker. Getting "Error: Cannot find module 'express'"
In my command line, I am already running the docker run command in the working directory. So should I mention the line WORKDIR...
Read more >
Build and run a Node.js app in a container - Visual Studio Code
Open the project folder in VS Code. Β· Open the Command Palette (Ctrl+Shift+P) and use Docker: Add Docker Files to Workspace... command: Β·...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found