Empty subfolders in node_modules after npm install

I’m having trouble with npm install. It creates the node_modules folder but some subfolders are empty. For example @parcel and @tailwindcss have no files in them.

My package.json looks like this:

{
  "name": "coin-tracker",
  "version": "1.5.0",
  "scripts": {
    "build-css": "npx @stylesheets/compiler -i ./src/css/main.css -o ./dist/css/styles.min.css --watch"
  },
  "devDependencies": {
    "@stylesheets/compiler": "^3.2.7",
    "stylesheets": "^3.2.7"
  }
}

I’m using Node v20.8.0 and npm 8.7.1. My .nvmrc file says lts/fermium.

When I try to run the build-css script, I get an error:

Error: Can't find 'stylesheets' in '/Users/johndoe/projects/coin-tracker/src/css'

I think it’s because the @stylesheets folder is empty in node_modules. Shouldn’t npm install put all the needed files there? What am I doing wrong?

I’ve dealt with this exact issue before, and it can be really frustrating. One thing that worked for me was using npm’s force option. Try running ‘npm install --force’. This overrides some of npm’s safety checks and can sometimes push through installation issues.

Also, I noticed you’re using a custom @stylesheets package. Sometimes these non-standard packages can cause problems. Have you considered switching to a more mainstream CSS processor like Sass or Less? They’re usually more reliable and have better community support.

If all else fails, you might want to look into using a package manager like pnpm or Yarn. They handle dependencies differently and can sometimes resolve issues that npm struggles with. Just remember to remove your node_modules and package-lock.json before switching package managers.

hey sofiag, sounds like a pain! i’ve had similar headaches. have u tried deleting the node_modules folder and running npm install again? sometimes that fixes weird issues. also, ur using a way newer node version than ur .nvmrc file says. maybe try switching to the older version with nvm use and see if that helps?

I’ve encountered similar issues before, and it’s often related to npm cache or network problems. Here are a few things you can try:

Clear your npm cache with ‘npm cache clean --force’. Delete your node_modules folder and the package-lock.json file, then run ‘npm install’ again.

If that doesn’t work, check your .npmrc file (if you have one) for any custom registry settings, as corporate networks or VPNs might interfere with npm installations.

Also, your Node version (v20.8.0) is much newer than the LTS version specified in your .nvmrc (fermium is v14.x). Consider switching to the Node version from .nvmrc with ‘nvm use’ and reinstalling modules, or try using Yarn instead of npm.