Hello there,
I’m changing the structure of mi repo from a single-repo using npm to a mono-repo with yarn workspaces.
The only issue that I’m facing is the NETLIFY_USE_YARN variable, if I set that value to true on the UI env configuration page the build works just fine (it detects that the package is inside a mono-repo and install the internal dependencies properly) but as I’m migrating from a single-repo any other build triggered from another branch-environment fails.
My first idea was to set the NETLIFY_USE_YARN = “true” in the proper contexts in netlify.toml
but that is not working, it still uses npm for dependency installation and the internal dependencies are not linked.
This is how I’m setting the env in netlify.toml:
[build.deploy-preview]
NETLIFY_USE_YARN = "true"
command = "CI=false REACT_APP_STAGE=dev ROLLBAR_ENV=preview ./build.sh"
I also tested putting the var inside the general [build] section but nothing changed.
Something important to mention is that yarn workspaces has yarn.lock files at the root level and not in the package base directory (that’s why I need the variable to indicates the use of yarn)
This is the build log:
3:01:34 PM: Build ready to start
3:01:38 PM: build-image version: 2cee85eb7f808bf3b6e87378c5307f9411f0a332
3:01:38 PM: build-image tag: v3.8.0
3:01:38 PM: buildbot version: cfefda0a665468fabfafc38698dc693541f06929
3:01:38 PM: Fetching cached dependencies
3:01:38 PM: Starting to download cache of 333.0MB
3:01:45 PM: Finished downloading cache in 7.56005925s
3:01:45 PM: Starting to extract cache
3:01:58 PM: Finished extracting cache in 12.430300978s
3:01:58 PM: Finished fetching cache in 20.038843994s
3:01:58 PM: Starting to prepare the repo for build
3:01:59 PM: Preparing Git Reference pull/331/head
3:02:00 PM: Parsing package.json dependencies
3:02:01 PM: Different build dir detected, going to use the one specified in the Netlify configuration file: 'apps/boss-client' versus '' in the Netlify UI
3:02:01 PM: Different publish path detected, going to use the one specified in the Netlify configuration file: 'apps/boss-client/build' versus 'build/' in the Netlify UI
3:02:01 PM: Different build command detected, going to use the one specified in the Netlify configuration file: 'CI=false REACT_APP_STAGE=dev ROLLBAR_ENV=preview ./build.sh' versus 'npm run build' in the Netlify UI
3:02:01 PM: Starting build script
3:02:01 PM: Installing dependencies
3:02:01 PM: Python version set to 2.7
3:02:02 PM: Started restoring cached node version
3:02:05 PM: Finished restoring cached node version
3:02:06 PM: v10.24.1 is already installed.
3:02:06 PM: Now using node v10.24.1 (npm v6.14.12)
3:02:06 PM: Started restoring cached build plugins
3:02:06 PM: Finished restoring cached build plugins
3:02:07 PM: Attempting ruby version 2.6.2, read from environment
3:02:08 PM: Using ruby version 2.6.2
3:02:08 PM: Using PHP version 5.6
3:02:08 PM: Started restoring cached node modules
3:02:08 PM: Finished restoring cached node modules
3:02:09 PM: Installing NPM modules using NPM version 6.14.12
3:02:15 PM: npm WARN deprecated babel-eslint@10.1.0: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.
3:02:16 PM: npm WARN deprecated uuid@3.0.1: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
3:02:16 PM: npm WARN deprecated core-js@2.6.12: core-js@<3.3 is no longer maintained and not recommended for usage due to the number of issues. Because of the V8 engine whims, feature detection in old core-js versions could cause a slowdown up to 100x even if nothing is polyfilled. Please, upgrade your dependencies to the actual version of core-js.
3:02:18 PM: npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
3:02:18 PM: npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
3:02:19 PM: npm WARN deprecated uuid@3.3.2: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
3:02:22 PM: npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
3:02:23 PM: npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
3:02:27 PM: npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
3:02:28 PM: npm WARN deprecated @hapi/joi@15.1.1: Switch to 'npm install joi'
3:02:28 PM: npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
3:02:30 PM: npm WARN deprecated sane@4.1.0: some dependency vulnerabilities fixed, support for node < 10 dropped, and newer ECMAScript syntax/features added
3:02:32 PM: npm WARN deprecated @hapi/bourne@1.3.2: This version has been deprecated and is no longer supported or maintained
3:02:32 PM: npm WARN deprecated @hapi/address@2.1.4: Moved to 'npm install @sideway/address'
3:02:32 PM: npm WARN deprecated @hapi/hoek@8.5.1: This version has been deprecated and is no longer supported or maintained
3:02:32 PM: npm WARN deprecated @hapi/topo@3.1.6: This version has been deprecated and is no longer supported or maintained
3:02:35 PM: npm ERR! code E404
3:02:35 PM: npm ERR! 404 Not Found - GET https://registry.npmjs.org/boss-ui - Not found
3:02:35 PM: npm ERR! 404
3:02:35 PM: npm ERR! 404 'boss-ui@1.0.0' is not in the npm registry.
3:02:35 PM: npm ERR! 404 You should bug the author to publish it (or use the name yourself!)
3:02:35 PM: npm ERR! 404 It was specified as a dependency of 'boss-client'
3:02:35 PM: npm ERR! 404
3:02:35 PM: npm ERR! 404 Note that you can also install from a
3:02:35 PM: npm ERR! 404 tarball, folder, http url, or git url.
3:02:35 PM: npm ERR! A complete log of this run can be found in:
3:02:35 PM: npm ERR! /opt/buildhome/.npm/_logs/2021-06-28T18_02_35_494Z-debug.log
3:02:35 PM: Error during NPM install
3:02:35 PM: Build was terminated: Build script returned non-zero exit code: 1
3:02:35 PM: Creating deploy upload records
3:02:35 PM: Failing build: Failed to build site
3:02:35 PM: Failed during stage 'building site': Build script returned non-zero exit code: 1
3:02:35 PM: Finished processing build request in 57.598454543s