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!)
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 ?
Two months later, and I finally understand what was going on!
If NODE_ENV is set to production then npm will not install anything in devDependencies
I feel like a dufus, but maybe this will help someone as baffled as I was
From the npm-install docs:
With the --production flag (or when the NODE_ENV environment variable is set to production ), npm will not install modules listed in devDependencies . To install all modules listed in both dependencies and devDependencies when NODE_ENV environment variable is set to production , you can use --production=false .