Skip to content
This repository has been archived by the owner on Jan 15, 2023. It is now read-only.

Missing package 'debug' for Express Application #36

Closed
ChetanBhasin opened this issue May 10, 2016 · 9 comments
Closed

Missing package 'debug' for Express Application #36

ChetanBhasin opened this issue May 10, 2016 · 9 comments

Comments

@ChetanBhasin
Copy link

While trying to package a NodeJS application I get the following stack trace:

> node ./bin/www

module.js:440
    throw err;
    ^

Error: Cannot find module 'debug'
    at Function.Module._resolveFilename (module.js:438:15)
    at Function.Module._load (module.js:386:25)
    at Module.require (module.js:466:17)
    at require (internal/module.js:20:19)
    at Object.<anonymous> (/bin/www:2:13)
    at Module._compile (module.js:541:32)
    at Object.Module._extensions..js (module.js:550:10)
    at Module.load (module.js:456:32)
    at tryModuleLoad (module.js:415:12)
    at Function.Module._load (module.js:407:3)

npm ERR! Linux 4.3.6-coreos
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "start"
npm ERR! node v6.1.0
npm ERR! npm  v3.8.9
npm ERR! code ELIFECYCLE
npm ERR! IoT-Playground@0.0.0 start: `node ./bin/www`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the IoT-Playground@0.0.0 start script 'node ./bin/www'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the IoT-Playground package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node ./bin/www
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs IoT-Playground
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls IoT-Playground
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /npm-debug.log

Not sure why this is happening. I even tried building my own node image by compiling everything from source (like you did), and the same thing happened.

Any idea what might be causing this?

@mhart
Copy link
Owner

mhart commented May 10, 2016

No idea – can you give some idea of what your app looks like? What dependencies does it have? What's the main file you're running (index.js?)

@mhart
Copy link
Owner

mhart commented May 10, 2016

Interestingly, when I was testing some things out with installing express, I found the following Node.js bug: nodejs/node#6679 – so try with mhart/alpine-node:5 and see if that fixes things – if so, then you've run into the same bug.

@ChetanBhasin
Copy link
Author

This looks like it. I tried changing the working directory and it solved the problem. I think it would be a good idea to change the working directory in the image itself.

@mhart
Copy link
Owner

mhart commented May 11, 2016

I disagree – the working directory of this base image should stay at the root, as it does for its parent (and the official node docker image) as there's no actual source or project files in this image. When a consumer adds a project or source in their Dockerfile, then they should specify whatever working directory they want (as shown in the example on the README).

Glad you solved the problem though! Hopefully that bug with v6 will be solved soon

@mhart mhart closed this as completed May 11, 2016
@ChetanBhasin
Copy link
Author

I see, that makes sense. Thanks for the help!

@yarosman
Copy link

Hi, I have the same problem but with morgan module, and I use mhart/alpine-node:latest. But when i build my docker image from mhart/alpine-node:5 it works fine. And i can't understand why?

@mhart
Copy link
Owner

mhart commented May 23, 2016

@Poison766 this comment explains why – it's a bug in Node v6.

@yarosman
Copy link

I read it. But when I use official image node:latest everything work fine without any problems

@mhart
Copy link
Owner

mhart commented May 24, 2016

@Poison766 ah, your question seemed to be why it worked in mhart/alpine-node:5 and not in mhart/alpine-node:latest

Have you tried setting your WORKDIR as specified in the example?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants