Conversation
The current `gradient-parser` version used by `@wordpress/components` contains error-generating code for certain environments. While it is unclear which specific environments, it does appear to occur for this project's build environment. See: rafaelcaricio/gradient-parser#11 Error: ``` can't find variable result ```
|
@dcalhoun I must be doing something wrong. I've uncommented |
|
@nbradbury given the proposed changes include a dependency version change, you'll need to ensure that updated dependency is installed and your local build is relying upon the development server. Will you let me know if the following resolves the issue?
If the above does not work, try repeating the steps and running If it continues to fail, please share the version the return of: cat ./node_modules/gradient-parser/package.json | grep "version" |
How do I do that? |
You would press Control+C in the terminal session where the development server is running—i.e., wherever you previously ran If you are unable to find that session, you could use the following to find the process and kill it: ps -ax | grep vite
kill -9 <relevant_process_id> |
Is that to say that the steps I outlined did not resolve the issue? Yes, your screenshot showcases the incorrect version is installed on your machine, which explains why you continue to see the Will you please complete the following and share the result?
For good measure, will you please also share the result of the following? node --version && npm --version |
|
@dcalhoun I've attached the output of running |
@nbradbury you appear to be encountering the same Node.js version issue we've discussed in the past (see p1738079888116949/1738074782.197839-slack-C011BKNU1V5). Node.js v20 is required for the project, and the likely reason the correct package version is failing to install. I highly recommend configuring
For additional insight, the first warning in the Footnotes
|
No, not in its current state. This stems from the fact that the demo editor does not attach to a site. No site → no theme → no theme settings → no style configuration support. Mocking the relevant endpoints in the demo app and returning reasonable fixture data would improve the development experience. It'd also be helpful to implement handlers for undo/redo, code editor, etc.
Thanks for catching this. 🙇🏻♂️ I opened #73 to fix the typo via GitHub's web interface.
|
This was added to fix a `can't find variable result` error. It appears that since then `@wordpress/components` upgraded the version it depends upon, making this override unnecessary. See: - #70 - WordPress/gutenberg#69783
* build: Upgrade dev dependencies to latest versions * build: Upgrade various `@wordpress` dependencies * build: Patch `@wordpress/editor` and `@wordpress/format-library` exports Enable importing the package's CSS files, which is promoted as an option in the Gutenberg Framework documentation: https://wordpress.org/gutenberg-framework/docs/intro#bootstrap-your-block-editor The package `exports` field was added in: WordPress/gutenberg@f13dcfa Without these exports, Vite's build fails with the following error: ``` (!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: Failed to scan for dependencies from entries: ./GutenbergKit/src/index.html ✘ [ERROR] Missing "./build-style/style.css" specifier in "@wordpress/format-library" package [plugin vite:dep-scan] src/utils/editor-styles.js:11:7: 11 │ import '@wordpress/format-library/build-style/style.css'; ╵ ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ This error came from the "onResolve" callback registered here: node_modules/esbuild/lib/main.js:1151:20: 1151 │ let promise = setup({ ╵ ^ at setup (file://./GutenbergKit/node_modules/vite/dist/node/chunks/config.js:31620:12) at handlePlugins (./GutenbergKit/node_modules/esbuild/lib/main.js:1151:21) ``` * build: Remove `@wordpress/core-commands` usage This existing import resulted in the following Vite build error. This began occurring after upgrading the package. Presumably, this began occurring due to the addition of the `exports` field to the package in: WordPress/gutenberg@f13dcfa ``` (!) Failed to run dependency scan. Skipping dependency pre-bundling. Error: The following dependencies are imported but could not be resolved: @wordpress/core-commands (imported by ./GutenbergKit/src/utils/wordpress-globals.js) Are they installed? at file://./GutenbergKit/node_modules/vite/dist/node/chunks/config.js:31896:33 at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async file://./GutenbergKit/node_modules/vite/dist/node/chunks/config.js:34104:15 ``` * build: Upgrade `@wordpress/block-library` * build: Upgrade `@wordpress/rich-text` * build: Vite `wordpress-externals-plugin` ignores raw file imports Disable externalization of `raw` imports as the global does not provide the required ability to inline the raw imported value. * build: Upgrade `@wordpress/components` to latest version * build: Upgrade `@wordpress/block-editor` to the latest version * refactor: Replace broken private `getLayoutStyles` API usage This once private API is now a public export of the new `@wordpress/global-styles-engine` package. WordPress/gutenberg@fa08e73df3#diff-3203defa3f9fa7d0f14af961ece72d1a2dabc639b1d746b975ab0d98fcfb7ab1L9-L10 * refactor: Scope editor content styles to block canvas Load these styles in the editor block canvas `iframe` to minimize potential style collisions in the top-level editor. These styles are only intended for content within the editor, not the editor UI itself. * fix: Improve toolbar styling consistency Rely upon the "toolbar" `variant` configuration to ensure each toolbar group renders a separating right border. * build: Fix lint errors from module resolution failures This `@wordpress/eslint-plugin@22.21.0` changed the import resolution behavior. This is incompatible with the GutenbergKit project for an unknown reason, possibly the lack of TypeScript setup. ``` Unable to resolve path to module '[module_name]' import/no-unresolved ``` See: https://github.com/WordPress/gutenberg/blob/2d2571507d8ea76f263089c98c46110403e3eba3/packages/eslint-plugin/CHANGELOG.md#22210-2025-11-12 * test: Avoid test failures from unlocking undefined stores With the previous mock, the entire `@wordpress/data` module was replaced. This led to emptying utilities like `createReduxStore`. This resulted in other `@wordpress` modules throwing errors when attempting to act upon stores. ``` FAIL src/utils/editor.test.jsx [ src/utils/editor.test.jsx ] Error: Cannot unlock an undefined object. ❯ unlock node_modules/@wordpress/private-apis/src/implementation.ts:186:9 ❯ node_modules/@wordpress/blocks/src/store/index.js:31:1 ❯ node_modules/@wordpress/blocks/src/index.js:11:1 ``` * build: Upgrade `@vitejs/plugin-react` The latest version of `@vitejs/plugin-react` is ESM-only. This is incompatible with `@wordpress/eslint-plugin`'s usage of `eslint-import-resolver-node`. Once `eslint-import-resolver-node` is upgraded or replaced with a more capable alternative, we can remove the `eslint-disable-line` comments. Resulting error: ``` Unable to resolve path to module '@vitejs/plugin-react' import/no-unresolved ``` See: vitejs/vite-plugin-react#691 (comment) * build: Upgrade `@wordpress/eslint-plugin` to latest `tsconfig.json` introduced as `@wordpress/eslint-plugin`'s replaced its usage of `eslint-import-resolver-node` with `eslint-import-resolver-typescript`. Those changes now require a `tsconfig.json` file to ensure the resolver works properly. The `tsconfig.json` does not add TypeScript support. See: WordPress/gutenberg@a4ba451#diff-691525462f8b4cac47c3c2e0e2668606f539ed0b3f62f8f6b79dffe7ef38bd9d `legacy-peer-deps=true` introduced to address a dependency version conflict. See Claude's explanation: > 1. eslint-import-resolver-typescript@4.4.4 has an optional peer dependency on eslint-plugin-import-x > 2. eslint-plugin-import-x requires @typescript-eslint/utils@^8.0.0 > 3. @wordpress/eslint-plugin@22.22.0 depends on @typescript-eslint/eslint-plugin@^6.4.1, which uses @typescript-eslint/utils@6.21.0 > > So we have: > - @typescript-eslint/utils@6.21.0 (from @wordpress/eslint-plugin chain) > - @typescript-eslint/utils@8.48.1 (wanted by eslint-plugin-import-x, optional peer of the resolver) > > Since eslint-plugin-import-x is marked as optional in the resolver, using --legacy-peer-deps should be safe. The resolver will work without it - it's > an alternative to eslint-plugin-import for those who want to use it. Once `@wordpress/eslint-plugin` updates its `@typescript-eslint` dependencies to v8.x, we can remove the `legacy-peer-deps` usage. * fix: Remove block library theme styles These styles overrode foundational styles causing unexpected layout bugs. E.g., the theme styles removed the top margin from image blocks. * refactor: Load component styles into block editor canvas This is no strictly necessary currently as we disable `shouldIframe`, but it further aligns GutenbergKit with Gutenberg. * docs: Remove outdated `@wordpress/components` patch reference The patch was removed in 6fc0ca5. * build: Install dependencies without `legacy-peer-deps` This was deemed to broad of a solution to a deep dependency version conflict described in e9f99f4. * build: Remove now unnecessary `gradient-parser` version override This was added to fix a `can't find variable result` error. It appears that since then `@wordpress/components` upgraded the version it depends upon, making this override unnecessary. See: - #70 - WordPress/gutenberg#69783 * build: Upgrade a few dev dependencies



What?
Fix a
can't find variable resulterror when setting a background gradient fora block.
Why?
Fixes #67. The error prevents setting a background gradient, resulting in a broken block.
How?
The current
gradient-parserversion used by@wordpress/componentscontains error-generating code for certain environments. While it is
unclear which specific environments, it does appear to occur for this
project's build environment.
See: rafaelcaricio/gradient-parser#11
Testing Instructions
Accessibility Testing Instructions
N/A, no user-facing changes.
Screenshots or screencast
N/A, no user-facing changes.