Advertisement
Help Keep Boards Alive. Support us by going ad free today. See here: https://subscriptions.boards.ie/.
If we do not hit our goal we will be forced to close the site.

Current status: https://keepboardsalive.com/

Annual subs are best for most impact. If you are still undecided on going Ad Free - you can also donate using the Paypal Donate option. All contribution helps. Thank you.
https://www.boards.ie/group/1878-subscribers-forum

Private Group for paid up members of Boards.ie. Join the club.

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

  • 04-11-2016 08:47AM
    #1
    Registered Users, Registered Users 2 Posts: 2


    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 !!


Comments

  • Registered Users, Registered Users 2 Posts: 36,095 ✭✭✭✭ED E


    You need to install the express package with NPM.

    BTW the mods can move this to Development, its more suited to programming/dev questions than C&T (which is mostly "My laptop is slow help xx").


  • Moderators, Technology & Internet Moderators Posts: 11,017 Mod ✭✭✭✭yoyo




Advertisement