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:

  • TravisCI build succeeds even when tests fail
  • How to remote access(from out net) to jupyter notebook running on docker on ubuntu server
  • docker-compose not setting environment variables
  • Dynamically get a running container name created by docker-compose
  • Dockerfile volume with database - using volume for mutable user-servicable parts
  • Why does different container of same elasticsearch image on docker exits out?
  • {
      "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?

  • File Not Found when running Laravel with Nginx using LaraDock
  • Is there a way to start a sibling docker container mounting volumes from the host?
  • docker-compose run --rm doesn't exit container after command is run
  • Pull an Image from Amazon ECR fails on Windows
  • Nginx Net::ERR_INCOMPLETE_CHUNKED_ENCODING when trying to show large JSON
  • Map process id of application on docker container with process id on host
  • 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.