cli: @netlify/build 2.42.0 breaks deploys

- Do you want to request a feature or report a bug? Bug

- What is the current behavior? Crashes during deploy

- If the current behavior is a bug, please provide the steps to reproduce. Netlify started failing my deploys since yesterday (8th of april), and I guess a new version of @netlify/build got released.

Netlify deployment logs

12:16:59 AM: Resolved Netlify Build version tag "latest" to "0.2.5"
12:16:59 AM: Netlify Build not installed. Installing Netlify Build version 0.2.5
12:17:21 AM: /opt/buildhome/.nvm/versions/node/v12.16.1/bin/netlify-build -> /opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/core/bin.js
12:17:21 AM: > core-js@3.6.4 postinstall /opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/node_modules/core-js
12:17:21 AM: > node -e "try{require('./postinstall')}catch(e){}"
12:17:22 AM: + @netlify/build@0.2.5
12:17:22 AM: added 588 packages from 325 contributors in 22.009s
12:17:22 AM: Starting Netlify Build...
12:17:25 AM: ​
12:17:25 AM: ❯ Starting Netlify Build v0.2.5
12:17:25 AM:   https://github.com/netlify/build
12:17:25 AM: ​
12:17:25 AM: ❯ Flags
12:17:25 AM:   nodePath: /opt/buildhome/.nvm/versions/node/v10.19.0/bin/node
12:17:25 AM: ​
12:17:25 AM: ❯ Current directory
12:17:25 AM:   /opt/build/repo
12:17:25 AM: ​
12:17:25 AM: ❯ Config file
12:17:25 AM:   /opt/build/repo/netlify.toml
12:17:25 AM: ​
12:17:25 AM: ❯ Context
12:17:25 AM:   production
12:17:25 AM: ​
12:17:26 AM: ❯ Loading plugins
12:17:26 AM:    - @netlify/plugin-functions-core from build core
12:17:26 AM: ​
12:17:26 AM: ❯ Running Netlify Build Lifecycle
12:17:26 AM:   Found 3 commands. Let's do this!
12:17:26 AM: 
12:17:26 AM: ┌───────────────────────────────────────────────────────────────────┐
12:17:26 AM: │ 1. Running onPreBuild command from @netlify/plugin-functions-core │
12:17:26 AM: └───────────────────────────────────────────────────────────────────┘
12:17:26 AM: ​
12:17:30 AM: Installing functions dependencies
12:17:30 AM: ​
12:17:30 AM: ┌────────────────────────────────────────────────────────┐
12:17:30 AM: │ Plugin "@netlify/plugin-functions-core" internal error │
12:17:30 AM: └────────────────────────────────────────────────────────┘
12:17:30 AM: ​
12:17:30 AM: ❯ Error message
12:17:30 AM:   Error: Error while installing dependencies in /opt/build/repo/functions/stripe-webhook
12:17:30 AM:   yarn install v1.17.0
12:17:30 AM:   warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
12:17:30 AM:   [1/4] Resolving packages...
12:17:30 AM:   [2/4] Fetching packages...
12:17:30 AM:   error https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/opt/buildhome/.cache/yarn/v4/npm-aws-sign2-0.7.0-b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8/node_modules/aws-sign2/README.md'"
12:17:30 AM:   info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.​
12:17:30 AM: ​
12:17:30 AM: ❯ Plugin details
12:17:30 AM:   ID:             @netlify/plugin-functions-core
12:17:30 AM:   Version:        0.2.5
12:17:30 AM:   npm link:       https://www.npmjs.com/package/@netlify/build​
12:17:30 AM: ​
12:17:30 AM: ❯ Error location
12:17:30 AM:   In "onPreBuild" event in npm package "@netlify/plugin-functions-core"
12:17:30 AM:       at runCommand (/opt/buildhome/.nvm/versions/node/v12.16.1/lib/node_modules/@netlify/build/src/install/main.js:24:20)
12:17:30 AM:       at process._tickCallback (internal/process/next_tick.js:68:7)
12:17:30 AM: ​

Running netlify build locally after upgrading to the latest cli version produces the following error (before upgrading worked perfectly fine):

TypeError: Cannot read property 'replace' of null
    at resolvePath (/home/andrepcg/.config/yarn/global/node_modules/@netlify/config/src/files.js:36:22)
    at searchBaseConfigFile (/home/andrepcg/.config/yarn/global/node_modules/@netlify/config/src/path.js:44:20)
    at getConfigPath (/home/andrepcg/.config/yarn/global/node_modules/@netlify/config/src/path.js:20:7)
    at getFullConfig (/home/andrepcg/.config/yarn/global/node_modules/@netlify/config/src/main.js:141:28)
    at loadConfig (/home/andrepcg/.config/yarn/global/node_modules/@netlify/config/src/main.js:113:13)
    at resolveConfig (/home/andrepcg/.config/yarn/global/node_modules/@netlify/config/src/main.js:60:40)
    at processTicksAndRejections (internal/process/task_queues.js:97:5)
    at async BuildCommand.getConfig (/home/andrepcg/.config/yarn/global/node_modules/netlify-cli/src/utils/command.js:76:14)

- Local Environment Information

────────────────────┐
 Environment Info   │
────────────────────┘

  System:
    OS: Linux 4.19 Debian GNU/Linux 10 (buster) 10 (buster)
    CPU: (4) x64 AMD Ryzen 7 3700X 8-Core Processor
  Binaries:
    Node: 12.16.2 - /usr/bin/node
    Yarn: 1.22.4 - /usr/bin/yarn
    npm: 6.14.4 - /usr/bin/npm

netlify-cli/2.42.0 linux-x64 node-v12.16.2

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Reactions: 9
  • Comments: 17 (7 by maintainers)

Most upvoted comments

Thank you all!

Thanks for the information @haphut!

If I am not mistaken, since that GitHub Action is not using any version pinning as you mentioned, it should respect semver for @netlify/config and install the latest 0.9.1 which should solve the issue.

Note: if anyone is using that GitHub Action and still experiences problems, please post a URL to your deploy logs, thanks!

@RaeesBhatti I have confirmed it to be working on netlify-cli@2.43.0. Cheers! 🎉

Hi,

I want to thank you very much for your fast response to the issue! Thanks again!

A new version (netlify-cli@2.43.0) has just been published. Please update and let us know if it fixes this problem. We’ll close this issue when we have confirmation.

Thanks for reporting this issue! I have created a PR (https://github.com/netlify/build/pull/1120) to solve this problem, I will let you know as soon as this available.

i just update netlify-cli version from 2.4.0 to 2.42.0 that i got same error in my terminal.

TypeError: Cannot read property 'replace' of null
    at resolvePath (C:\Users\owner\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\@netlify\config\src\files.js:36:22)
    at searchBaseConfigFile (C:\Users\owner\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\@netlify\config\src\path.js:44:20)
    at getConfigPath (C:\Users\owner\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\@netlify\config\src\path.js:20:7)
    at getFullConfig (C:\Users\owner\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\@netlify\config\src\main.js:140:28)
    at loadConfig (C:\Users\owner\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\@netlify\config\src\main.js:112:13)
    at resolveConfig (C:\Users\owner\AppData\Roaming\npm\node_modules\netlify-cli\node_modules\@netlify\config\src\main.js:59:40)
    at process._tickCallback (internal/process/next_tick.js:68:7)

Yessss!! Wow you guys are amazing!

It’s fixed!

image

Fantastic @ehmicky! Thank you.

@ehmicky Thank You, Updating the netlify-config dependency to 0.9.1 fixed the issue.

There are two separate problems in this issue.

  1. Deploys crash with Netlify CLI with the Cannot read property 'replace' of null error message. This should be fixed by #813. This PR might take some time to publish to npm. In the meantime, you can do the following to get the fix right away:
  • remove your package-lock.json or yarn.lock and re-install netlify-cli
  • run npm ls @netlify/config (or npm ls -g @netlify/config if netlify-cli is installed globally). You should see the following:
netlify-cli@2.42.0
├─┬ @netlify/build@0.2.6
│ └── @netlify/config@0.9.1  deduped
├── @netlify/config@0.9.1 
└─┬ netlify-redirect-parser@2.3.0
  └── @netlify/config@0.4.12
  • make sure that @netlify/config is shown as 0.9.1 in the message above (except the one under netlify-redirect-parser)
  • if @netlify/config is indeed 0.9.1 but the error message still appear, please let me know
  1. The following error happens in some builds:
error https://registry.yarnpkg.com/aws-sign2/-/aws-sign2-0.7.0.tgz: Extracting tar content of undefined failed, the file appears to be corrupt: "ENOENT: no such file or directory, stat '/opt/buildhome/.cache/yarn/v4/npm-aws-sign2-0.7.0-b46e890934a9591f2d2f6f86d7e6a9f1b3fe76a8/node_modules/aws-sign2/README.md'"

It looks like this error message has to do with aws and therefore should only impact builds that use aws. I am currently investigating that issue.

Thank you for reporting this issue @andrepcg. We’ll get back to you with more information soon