Build has stopped since I changed the build command to yarn instead of npm

Hi,

I changed the build command from npm to yarn - yarn install && yarn run build.

However, I am getting error when deploying the site now.

This is the URL - https://rejaur-rahman.netlify.app

1:53:17 AM: Failing build: Failed to parse configuration
1:53:17 AM: Failed during stage 'Reading and parsing configuration files': 
When resolving config:
Base directory does not exist: /opt/build/repo/dist

I added the base directory as dist. Publish directory it says its Not set

Please can someone help me with this.

Regards,

Ronny

Hey @Ronny

Is there a yarn.lock file in the repository? Netlify will only use yarn if the lock file is present or NETLIFY_USE_YARN environment variable is set.

yarn install is not required as Netlify automatically installs packages listed in the package.json file.

Likely dist is not the base directory, but the publish directory.

Hi, I have yarn .lock in the root of the repository. Regards, Ronny

Hi, I also changed removed base directory and set the publish directory to public as I renamed dist to public

And does the build succeed now?

I am getting the following error:

2:31:34 AM: error lazyload-webpack-plugin@0.2.0: The engine "node" is incompatible with this module. Expected version ">= 14". Got "12.18.0"
2:31:34 AM: error Found incompatible module.
2:31:34 AM: info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.
2:31:34 AM: Creating deploy upload records
2:31:34 AM: Error during Yarn install
2:31:34 AM: Build was terminated: Build script returned non-zero exit code: 1
2:31:34 AM: Failing build: Failed to build site
2:31:34 AM: Failed during stage 'building site': Build script returned non-zero exit code: 1 (https://ntl.fyi/exit-code-1)
2:31:34 AM: Finished processing build request in 19.936328817s

Can you share the repository you are deploying and the build settings you are currently using.

The repository is the following - https://github.com/RejaurRahman/portfolio

I have attached the build settings for the project

Was able to build and deploy without issue.

Have you tried doing a “Clear cache and deploy site” build?

clear-cache-and-deploy-site

Still having same issue

Fixed the issue had to add .nvmrc file to the root of the repo and set the add v14

1 Like