node can't find modules that exists in parent node_modules folder

I am using node 0.12.0 with express and created a Docker image.
This is my directory structure:

-server/
    -config/
        -config.js
    -app.js
    -package.json
    -node-modules/
        -deep-extend/
            -...
            -...
            -...

My package.json looks like:

  • Adding tags to docker image from jenkins
  • how can I set the working directory in old version of docker in the run command?
  • Ruby: Catching Sequel::DatabaseConnectionError
  • Deploying Cassandra on ECS?
  • Docker containers exiting without identifiable cause (Django web application)
  • Docker for mac does not pull any image
  • {
      "name": "test",
      "version": "2.0.0",
      "private": true,
      "dependencies": {
        ...
        ...
        "deep-extend": "^0.3.2",
        ...
        ...
      }
    }
    

    and config/config.js looks like:

    var deepExtend = require('deep-extend');
    ...
    ...
    ...
    module.exports = deepExtend({}, .....);
    

    I have an issue running this app. When running it with node server/app I got and error:

    Error: Cannot find module 'deep-extend'
    

    When running the following, the problem solved and node server/app runs fine:

    cd config
    npm install deep-extend
    

    When is the problem?
    Why node doesn’t look on parent folder for node_modules?

  • docker permission for a container in /sys/fs/cgroups/devices
  • Write permissions for IBM Containers Volume as non-root user
  • Types of errors docker in Windows?
  • How to open swagger-ui using docker
  • Unable to access Asp.Net vNext application hosted in Docker Container in Windows Server 2016 Azure VM [Solved]
  • When does Docker write to iptables?
  • One Solution collect form web for “node can't find modules that exists in parent node_modules folder”

    In order to solve this I had to add the node_modules folder into my NODE_PATH environment variable.

    Docker will be the best open platform for developers and sysadmins to build, ship, and run distributed applications.