Skip to content

Module installation process

Heiko Mathes edited this page Feb 5, 2017 · 2 revisions

These are the steps minstall takes, to install the local modules:

  1. Look for a modules-folder, and for modules in it
  2. Gather the module details from the package.json of every module.
  3. Remove all module-symlinks from the root-node_modules
  4. check, what dependencies are missing, and what dependencies are conflicting with packages already installed in the root-node_modules
  5. check, if some (or all) of the conflicting dependencies are already installed in a possibly existing module-node_modules-folder
  6. if conflicting dependencies exist:
    1. create a new folder in the root-node_modules with the name module.folderName + '_cache'
    2. move all the already installed packages that are in the root-node_modules and would conflict with the module-dependencies into that cache-folder
  7. if in step 5 fitting packages were found, move them to the root-node_modules (this is only to speed up things, so less packages need to be installed)
  8. if one exists, delete the module-node_modules folder
  9. now that there is no longer a conflicting package in the root-node_modules, install all the missing dependencies to the root-node_modules
  10. if the module has a postinstall-script:
    1. create a symlink in the module-folder, that points to the root-node_modules
    2. now that a node_modules-folder with all the fitting dependencies is in the module-folder, run the postinstall-script
    3. delete the previously created symlink
  11. if in step 4, conflicting dependencies were found:
    1. create a node_modules-folder in the module-folder
    2. move all the packages from the root-node_modules-folder that would have caused conflicts to the newly created module-node_modules-folder
    3. move all the cached packages from step 6.2 (those in module.folderName + '_cache' in the root-node_modules) out of that folder, to their original place in the root-node_modules
    4. delete the module.folderName + '_cache'-folder created in step 6.1 from the root-node_modules
  12. update the list of installed packages
  13. start over at step 4 with the next module until all modules are installed
  14. if the --no-link flag is not set, symlink all the modules to the root-node_modules
Clone this wiki locally