Netlify breaks after adding netlify.toml file

This is a common issue on Netlify when people want to use NODE_ENV to make decisions for their builds with custom build scripts, etc.

By default the build bots on Netlify set NODE_ENV to development, so yarn will install the dev dependencies.

If vuepress is in your devDependencies, yarn will ignore them when Netlify runs the yarn install automatically. There are a couple work arounds.

  • use: NODE_ENV=development yarn install && yarn docs:build
  • use: yarn add vuepress && yarn docs:build
  • remove the env variable setting if you don't need it. If you need to know if it is a production build, you can always use CONTEXT which is set by Netlify on a production build.

There are some other options, but I'll leave it here for brevity.