Home
Support Forums

How do I stop my deploy failing based on devDependencies?

When I remove devDependencies everything deploys properly. However, when I include devDependencies it fails because two of my devDependencies are workspace:* dependencies (this is a documentation site as part of a monorepo). For example:

"@re-do/test": "workspace:*",
"@re-do/configs": "workspace:*",

I am using the netlify.toml file to deploy and expected NODE_ENV = “production” to skip devDependencies but it doesn’t seem to skip them - or perhaps it notices them but doesn’t try to install them? Here’s my netlify.toml file (which works when I remove devDependencies):

[build.environment]
  NODE_ENV = "production"
[build]
  command = "npm run build"
  publish = "build"

Hi @mclimb,

Are you using npm or yarn workspaces? Can we have a repo to test?

I am using yarn. I just updated the netlify.toml in the pkgs/documentation to be:

[build.environment]
  NODE_ENV = "production"
  NETLIFY_USE_YARN = "true"
[build]
  command = "yarn run build"
  publish = "build"

The error I see is still:

error Couldn't find any versions for "@re-do/test" that matches "workspace:*"

The link to the repo is GitHub - mclimb/redo: Automated testing that builds itself.

I’m trying to deploy the pkgs/documentation site rather than the website portion of the monorepo which has a separate top-level netlify.toml file.

Hi @mclimb

Sorry for taking some time on this. It’s partly because I’m not familiar with Rush or how it’s working.

I was checking your repo but I’m confused. Could you share the site name that you’re trying this on?

My guess is that you’re trying to set a base directory from the UI and then using yarn in that directory to install the dependencies. This would probably not work. What I’d rather advise is to set the base path as the root of the repo, keep your build command same as the TOML file in the root and just change the end argument to your documentation folder instead of the website folder. You probably can’t do this till you have a TOML file in the repo, so you’d have to remove that and set it in the UI.