lwc-garden icon indicating copy to clipboard operation
lwc-garden copied to clipboard

@lwrjs/markdown-view-provider: The requested module 'unist-util-visit' does not provide an export named 'default'

Open zerkz opened this issue 1 year ago • 1 comments

OS: OS X Sonoma Machine : M2 macbook pro

Using nvm, specifically node 18.17.1.

Here's basically what I did:

nvm use --lts
npm install -g pnpm
git clone https://github.com/lukethacoder/lwc-garden
cd lwc-garden
pnpm install 
pnpm run examples:minimal-config

result:

❯ pnpm run examples:minimal-config

> [email protected] examples:minimal-config /Users/zdware/test_lwc_garden/lwc_garden/lwc-garden
> pnpm --filter=@lwc-garden/example-minimal-config dev

examples/disable-lwc-synthetic-shadow    |  WARN  The field "pnpm" was found in /Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/examples/disable-lwc-synthetic-shadow/package.json. This will not take effect. You should configure "pnpm" at the root of the workspace instead.

> @lwc-garden/[email protected] dev /Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/examples/minimal-config
> npx @lwc-garden/core dev

[config] peer dependency pwa-kit-runtime was not provided
(node:19787) ExperimentalWarning: Import assertions are not a stable feature of the JavaScript language. Avoid relying on their current behavior and syntax as those might change in a future version of Node.js.
(Use `node --trace-warnings ...` to show where the warning was created)
(node:19787) ExperimentalWarning: Importing JSON modules is an experimental feature and might change at any time
[error] The requested module 'unist-util-visit' does not provide an export named 'default'
file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]/node_modules/@lwrjs/markdown-view-provider/build/es/markdown-parser/plugins/highlighter.js:3
import visit from 'unist-util-visit';
       ^^^^^
SyntaxError: The requested module 'unist-util-visit' does not provide an export named 'default'
    at ModuleJob._instantiate (node:internal/modules/esm/module_job:124:21)
    at async ModuleJob.run (node:internal/modules/esm/module_job:190:5)
file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@lwrjs/config/build/es/modules.js:22
        throw new Error(`Unable to load configurable module: ${filepath}`);
              ^

Error: Unable to load configurable module: @lwrjs/markdown-view-provider
    at importModule (file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@lwrjs/config/build/es/modules.js:22:15)
    at async file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@lwrjs/config/build/es/modules.js:27:22
    at async Promise.all (index 2)
    at async loadServices (file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected][email protected]/node_modules/@lwrjs/config/build/es/modules.js:66:27)
    at async initContext (file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@lwc+feature_qoiabfklmdermkrbhjie3vnuei/node_modules/@lwrjs/core/build/es/index.js:53:22)
    at async LwrApp.init (file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@lwc+feature_qoiabfklmdermkrbhjie3vnuei/node_modules/@lwrjs/core/build/es/index.js:121:29)
    at async LwrApp.listen (file:///Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/node_modules/.pnpm/@[email protected]_@[email protected]_@[email protected]_@[email protected]_@lwc+feature_qoiabfklmdermkrbhjie3vnuei/node_modules/@lwrjs/core/build/es/index.js:134:9)

Node.js v18.17.1
/Users/zdware/test_lwc_garden/lwc_garden/lwc-garden/examples/minimal-config:
 ERR_PNPM_RECURSIVE_RUN_FIRST_FAIL  @lwc-garden/[email protected] dev: `npx @lwc-garden/core dev`
Exit status 1
 ELIFECYCLE  Command failed with exit code 1.
 

zerkz avatar Apr 16 '24 04:04 zerkz

ah yes, this infamous issue. Not too sure why I run into this, sometimes its fine, othertimes it causes issues.

Simple enough fix is to open the source files for the @lwrjs/markdown-view-provider package and change all references of import visit from 'unist-util-visit' to instead be import { visit } from 'unist-util-visit'.

A shame the @lwrjs/* packages are all closed source and don't have a nice place to raise these sorts of issues.

lukethacoder avatar Apr 16 '24 11:04 lukethacoder