Cannot Find Module 'express' With Node.js Using Docker

Satellite Toshiba satellite c55-a5310 15...
November 4, 2016 at 01:25:35
Specs: Windows 7, 500
I'm a newbie with Docker and I'm trying to start with NodeJS hosted in asphostportal.com so here is my question..

I have this Dockerfile inside my project:


FROM node:argon

# Create app directory
RUN mkdir -p /home/Documents/node-app
WORKDIR /home/Documents/node-app

# Install app dependencies
COPY package.json /home/Documents/node-app
RUN npm install

# Bundle app source
COPY . /home/Documents/node-app

EXPOSE 8080
CMD ["npm", "start"]


When I run a container with


docker run -d -p 49160:8080 node-container

it works fine..
But when I try to map my host project with the container directory (


docker run -p 49160:8080 -v ~/Documentos/nodeApp:/home/Documents/node-app node-cont

) it doesn't work.
The error I get is:

Code:

Error: Cannot find module 'express'

I've tried with other solutions from related questions but nothing seems to work for me (or I know.. I'm just too rookie with this)
Thank you !!I'm a newbie with Docker and I'm trying to start with NodeJS hosted in asphostportal.com so here is my question..

I have this Dockerfile inside my project:


FROM node:argon

# Create app directory
RUN mkdir -p /home/Documents/node-app
WORKDIR /home/Documents/node-app

# Install app dependencies
COPY package.json /home/Documents/node-app
RUN npm install

# Bundle app source
COPY . /home/Documents/node-app

EXPOSE 8080
CMD ["npm", "start"]


When I run a container with


docker run -d -p 49160:8080 node-container

it works fine..
But when I try to map my host project with the container directory (


docker run -p 49160:8080 -v ~/Documentos/nodeApp:/home/Documents/node-app node-cont

) it doesn't work.
The error I get is:

Code:

Error: Cannot find module 'express'

I've tried with other solutions from related questions but nothing seems to work for me (or I know.. I'm just too rookie with this)
Thank you !!I'm a newbie with Docker and I'm trying to start with NodeJS hosted in asphostportal.com so here is my question..

I have this Dockerfile inside my project:


FROM node:argon

# Create app directory
RUN mkdir -p /home/Documents/node-app
WORKDIR /home/Documents/node-app

# Install app dependencies
COPY package.json /home/Documents/node-app
RUN npm install

# Bundle app source
COPY . /home/Documents/node-app

EXPOSE 8080
CMD ["npm", "start"]


When I run a container with


docker run -d -p 49160:8080 node-container

it works fine..
But when I try to map my host project with the container directory (


docker run -p 49160:8080 -v ~/Documentos/nodeApp:/home/Documents/node-app node-cont

) it doesn't work.
The error I get is:

Code:

Error: Cannot find module 'express'

I've tried with other solutions from related questions but nothing seems to work for me (or I know.. I'm just too rookie with this)
Thank you !!


See More: Cannot Find Module express With Node.js Using Docker

Report •

#1
November 20, 2016 at 23:00:51
A very complicated problem.

have you tried asking someone who also uses Docker?


Report •

#2
September 4, 2017 at 10:57:37
I also cant do it :(

Report •
Related Solutions


Ask Question