Production deploy fails when branch deploy succeeds

In distracted-saha-1575e4:

the branch deploy completes successfully and logs end with site is live

the production deploy fails because webpack (the code bundler) Cannot find module 'extract-css-chunks-webpack-plugin'

The problem is that each is exactly the same code, exactly the same commit. Literally, this is the HEAD, wherein master is the production branch and feature/svelte is the branch that deploys successfully: commit b4a1368fb17f115e49712f3a79541cf7fe3fde5e (HEAD -> master, origin/master, origin/feature/svelte, feature/svelte)

Needless to say, the missing module is in the package manifest package.json

Is there is some difference in the environment between the two that I should be aware of?

Update: I cleared the cache and redeployed the failing build. Now it’s failing for a different, but similar, reason: the environment cannot find a package that is definitely in the manifest.

(in this case it’s rimraf, platform-neutral node command that removes directories)

12:33:12 PM: > rimraf public && rimraf functions
12:33:12 PM: sh: 1: rimraf: not found

(I deleted an earlier question “Branch Deploy” versus “Deploy Preview” because I was conflating this specific issue with another one. My apologies to @futuregerald who answered there. I never did get to see your answer!)

Ah ha! I deleted the cache on the successful deploy and that fails with the same error!

The difference between the environments was that the production branch had a different cache.

The question now is why? Why isn’t npm install pulling those missing modules?

… and I redeployed this failed deploy, and rimraf now works but we’re back to the previous error of the missing webpack plugin.

I finally succeeded, but I’m not sure why it worked. I moved the category of some of the packages in the manifest from "devDependencies" to "dependencies" and then the build process completed.

I’ll need to do some more searching about why it happened, but I’ll leave this here in case anyone in the future has this kind of issue.

thanks for providing the rundown, rendall! I am wondering if maybe moving the dependencies from one section to another maybe forced a package update which solved a problem we weren’t aware of ? :thinking:

1 Like