Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Executing yarn webiny extension to create a PageBuilder Element results in error #4367

Open
alifeinbinary opened this issue Nov 6, 2024 · 1 comment
Labels

Comments

@alifeinbinary
Copy link

Version

5.41.1

Operating System

MacOS 14.7.1

Browser

N/A

What are the steps to reproduce this bug?

  1. Install/upgrade to Webiny 5.41.1
  2. run yarn webiny extension in the project root
  3. Select Page Builder Element
  4. Choose a name for the extension
  5. Accept default directory
  6. Accept default package name
  7. Do or don't install a dependency, this does not effect outcome

What is the expected behavior?

It's expected that the pageBuilder Element be scaffolded and any dependencies be installed without issue.

What do you see instead?

yarn webiny extension
? What type of an extension do you want to create? Page Builder element
? Enter the extension name: calendly
? Enter the extension location: extensions/calendly
? Enter the package name: calendly
? Enter one or more NPM dependencies (optional): 
✖ Could not create extension. Please check the logs below.

Error: Command failed with exit code 1: yarn install
➤ YN0000: · Yarn 4.5.0
➤ YN0000: ┌ Resolution step
➤ YN0082: │ @webiny/app-page-builder-elements@npm:0.0.0: No candidates found
➤ YN0000: └ Completed in 0s 557ms
➤ YN0000: · Failed with errors in 0s 573ms
    at makeError (/Users/andrew/www/alifeinbinary-aws/node_modules/execa/lib/error.js:60:11)
    at handlePromise (/Users/andrew/www/alifeinbinary-aws/node_modules/execa/index.js:118:26)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async runYarnInstall (/Users/andrew/www/alifeinbinary-aws/node_modules/@webiny/cli-plugin-scaffold/utils/runYarnInstall.js:10:3)
    at async generateExtension (/Users/andrew/www/alifeinbinary-aws/node_modules/@webiny/cli-plugin-extensions/generateExtension.js:116:5) {
  shortMessage: 'Command failed with exit code 1: yarn install',
  command: 'yarn install',
  escapedCommand: 'yarn install',
  exitCode: 1,
  signal: undefined,
  signalDescription: undefined,
  stdout: '➤ YN0000: · Yarn 4.5.0\n' +
    '➤ YN0000: ┌ Resolution step\n' +
    '➤ YN0082: │ @webiny/app-page-builder-elements@npm:0.0.0: No candidates found\n' +
    '➤ YN0000: └ Completed in 0s 557ms\n' +
    '➤ YN0000: · Failed with errors in 0s 573ms',
  stderr: '',
  failed: true,
  timedOut: false,
  isCanceled: false,
  killed: false
}

Additional information

yarn -v
4.5.0

node -v
v20.12.1

Possible solution

Judging by the error it looks like the command tries to install @webiny/app-page-builder-elements during the scaffold process, however, it specifies version 0.0.0 which doesn't exist in NPM. Version 0.0.0 is the version webiny packages use internally when developing Webiny where packages reference a package build in a local directory within the Webiny codebase and not a compiled package from NPM. The command should populate the current webiny version in its place, like so: @webiny/app-page-builder-elements@npm:5.41.1

It looks like packages/cli-plugin-extensions/src/utils/setWebinyPackageVersions.ts is a utility for appending the current Webiny version to the @webiny package that gets installed alongside the PbElement, however, this utility does not get called around line 90 of packages/cli-plugin-extensions/src/generateExtension.ts, which perhaps it should.

If the Webiny team believes this this solution would be adequate, then I would gladly submit a PR with the fix.

@adrians5j
Copy link
Member

Awesome @alifeinbinary , will fix this for 5.40.2!

🍻

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants