After running npm install installs with no errors, node_modules is empty

Posted January 16, 2017 37.5k views

I am looking to move my react app over to a DO droplet and I came across this well written tutorial by ( After I clone my repo and run ‘sudo npm install’, all goes well with no errors. However when looking in the node_modules folder, nothing is there. This results in missing module errors when running express server and webpack build. Has anyone run across this issue?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
3 answers

Update: Did not seem to do the trick. Was in my local terminal when i ran the cache clean, thinking it worked. However, upon running it in the droplet terminal, no luck.

Not if this will help, but here is a screenshot of the install..

  • @lsbyerley

    I just deployed a fresh Ubuntu 16.10 64bit Droplet (4GB) and installed NodeJS using NodeSource [link].

    After the installation finished up, I copied the contents of your package.json file over to the new Droplet and ran sudo npm install and what popped up on my end was:

    npm WARN deprecated minimatch@2.0.10: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
    npm WARN deprecated minimatch@0.2.14: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
    npm WARN deprecated graceful-fs@1.2.3: graceful-fs v3.0.0 and before will fail on node releases >= v7.0. Please update to graceful-fs@^4.0.0 as soon as possible. Use 'npm ls graceful-fs' to find it in the tree.
    npm WARN prefer global node-gyp@3.5.0 should be installed with -g
    npm WARN prefer global babel@5.8.38 should be installed with -g


    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.0.0 (node_modules/chokidar/node_modules/fsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.0.17: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
    npm WARN react-tweet@1.0.22 requires a peer of react@0.14.0 but none was installed.
    npm WARN react-tweet@1.0.22 requires a peer of react-dom@0.14.0 but none was installed.
    npm WARN react-videojs@0.0.2 requires a peer of react@^0.14.0 but none was installed.
    npm WARN react-videojs@0.0.2 requires a peer of react-dom@^0.14.0 but none was installed.
    npm WARN my-react-spa@1.0.0 No repository field.

    … however, it did complete and the node_modules folder was populated with 824 new directories relating to the contents of package.json.

    So there’s two possible scenarios that I can think of off the top of my head.

    1). You need to update NodeJS, or downgrade. I used NodeSource’s 7.x installer and the output above is from 7.x. I would recommend trying their installer and seeing if that’ll help get things working. If it doesn’t, #2 may be the cause.

    2). Since this is a rather hefty load, your Droplet may be running out of resources (i.e. RAM) and as a result, it’s being killed off to prevent crashing. From what I can see, when this does happen, npm won’t actually download anything, thus you’ll end up with an empty directory.

    • Appreciate you taking the time to look into this @jtittle. I’m leaning toward option 2 being the problem. I see that you used a 4GB droplet and it worked, whereas my droplet is the 512mb. I can install individual modules without a problem, but all at once seems to fail.

      • @lsbyerley

        I have tested larger installs on 512MB Droplets and can confirm the same. As far as I am aware, there’s not an option to install or update in chunks (without manually doing each module by hand). I would recommend trying this on a 1GB Droplet. I know it worked on both 2GB and 4GB droplets, but I didn’t run the test on a 1GB Droplet just yet.


Have you checked your package.json file to verify whether or not the projects’ dependencies have been saved, thus allowing npm to pull them down when you run npm install?

this is my package.json file used when running npm install. The first error I see when trying to run my build is Error: Cannot find module ‘del’

  "name": "my-react-spa",
  "version": "1.0.0",
  "main": "server.js",
  "description": "--",
  "scripts": {
    "start": "gulp"
  "author": "--",
  "license": "ISC",
  "dependencies": {
    "axios": "^0.15.3",
    "cheerio": "^0.22.0",
    "ejs": "^2.5.1",
    "express": "^4.13.4",
    "json-server": "^0.9.2",
    "lodash": "^4.14.0",
    "moment": "^2.14.1",
    "react": "^15.0.1",
    "react-addons-css-transition-group": "^15.4.1",
    "react-bootstrap": "^0.30.7",
    "react-dom": "^15.0.1",
    "react-fontawesome": "^1.1.0",
    "react-helmet": "^3.2.2",
    "react-redux": "^4.4.1",
    "react-router": "3.0.0",
    "react-tweet": "^1.0.22",
    "redux": "^3.3.1",
    "request": "^2.74.0",
    "scrollreveal": "^3.2.0",
    "twitter": "^1.3.0"
  "devDependencies": {
    "autoprefixer": "^6.5.3",
    "babel-cli": "^6.18.0",
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.7",
    "babel-preset-es2015": "^6.18.0",
    "babel-preset-react": "^6.16.0",
    "babel-preset-stage-2": "^6.18.0",
    "css-loader": "^0.26.0",
    "del": "^2.2.0",
    "extract-text-webpack-plugin": "^1.0.1",
    "gulp": "^3.9.1",
    "gulp-nodemon": "^2.2.1",
    "gulp-rename": "^1.2.2",
    "node-sass": "^3.13.0",
    "postcss": "^5.2.5",
    "postcss-loader": "^1.1.1",
    "precss": "^1.4.0",
    "sass-loader": "^4.0.2",
    "style-loader": "^0.13.1",
    "webpack": "^1.13.3",
    "webpack-stream": "^3.1.0"
  • @lsbyerley

    I’ve tried running the install command locally and remotely and can’t seem to reproduce, so I’m a bit puzzled to be honest.

    Have you tried running npm cache clean and then running the install command again?

    In some cases, I’ve read on StackExchange that some have to run the install command multiple times before npm will install larger sets of dependencies. I’ve never had this issue, though my primary development language isn’t NodeJS, so for the projects I’ve worked on, I’ve not had a huge number of dependencies.