npm Gulp dependencies missing, even after running npm install

14,904

The solution was to delete the node_modules folder and rerun npm install.

It looks like the initial install failed partially for some reason.

Share:
14,904
harryg
Author by

harryg

Software engineer for 🌳 energy ⚡️ provider. I work mostly with TypeScript in React and the server. I am a strong proponent of functional programming and as well as writing functional code in my day-to-day projects I also enjoy learning and tinkering with "purer" functional languages such as Elixir, Elm, Haskell and PureScript.

Updated on June 13, 2022

Comments

  • harryg
    harryg almost 2 years

    I have a project that uses Gulp. I deployed my project onto my Ubuntu server and now want to compile the assets (which is all my gulpfile does at the moment). Having installed Node and npm I run npm install from my project's root to install the dependencies. The package.json reads as follows:

      ...},
      "devDependencies": {
        "bower": ">=1.3.12",
        "gulp": "^3.8.10",
        "gulp-concat": "^2.4.3",
        "gulp-less": "^2.0.1",
        "gulp-minify-css": "^0.4.3",
        "gulp-notify": "^2.2.0",
        "gulp-rename": "^1.2.0",
        "gulp-uglify": "^1.1.0"
      }...
    

    Upon then inspecting the node_modules folder in my project root I can see directories for each of the dependencies indicating they were installed. However when I run gulp I get npm errors such as the below:

    Error: Cannot find module 'through2'
        at Function.Module._resolveFilename (module.js:338:15)
        at Function.Module._load (module.js:280:25)
        at Module.require (module.js:364:17)
        at require (module.js:380:17)
    

    These seem to be dependencies of the my project's dependencies (as they are not referenced in my gulpfile), but why hasn't npm installed them?

    I can manually install each one as the error arises but I then get another similar error for the next missing dependency.

    How can I solve this?

  • Andrew
    Andrew almost 9 years
    this worked unlike trying to run npm uninstall.