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

walk package error if @spectrum-web-components/action-menu is installed even if not used #1309

Open
lschierer opened this issue Nov 11, 2024 · 5 comments
Assignees
Labels
bug Something isn't working CLI
Milestone

Comments

@lschierer
Copy link
Contributor

Type of Change

Bug

Summary

even if not used, if @spectrum-web-components/action-menu is installed as a dependency, you will get the following error when first loading a page:

-------------------------------------------------------
Welcome to Greenwood (v0.30.1) ♻️
-------------------------------------------------------
Initializing project config
Initializing project workspace contexts
Generating graph of workspace files...
building from local sources...
Running Greenwood with the develop command.
Started local development server at http://localhost:1984
Now watching workspace directory (./src) for changes...
TypeError [ERR_INVALID_ARG_TYPE]: The "path" argument must be of type string. Received an instance of Object
    at Object.join (node:path:1250:7)
    at walkPackageJson (file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lib/walker-package-ranger.js:176:65)
    at async walkPackageJson (file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lib/walker-package-ranger.js:200:9)
    at async walkPackageJson (file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lib/walker-package-ranger.js:200:9)
    at async walkPackageJson (file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lib/walker-package-ranger.js:200:9)
    at async walkPackageJson (file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lib/walker-package-ranger.js:200:9)
    at async NodeModulesResource.intercept (file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/plugins/resource/plugin-node-modules.js:96:9)
    at async file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lifecycles/serve.js:140:27
    at async file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lifecycles/serve.js:138:38
    at async file:///Users/lschiere/src/schierer/greenwood-repoductions/node_modules/@greenwood/cli/src/lifecycles/serve.js:138:38 {
  code: 'ERR_INVALID_ARG_TYPE'
}

Details

  1. check out https://github.com/lschierer/greenwood-repoductions/tree/walkPackage
  2. npm i
  3. npm run dev
  4. open a browser to http://localhost:1984

observe error in terminal

@lschierer
Copy link
Contributor Author

lschierer commented Nov 11, 2024

I was able to use some of the other spectrum-web-components packages successfully, unsure what is different about this one.

    "@spectrum-web-components/shared": "^1.0.1",
    "@spectrum-web-components/styles": "^1.0.1",
    "@spectrum-web-components/theme": "^1.0.1",
    "@spectrum-web-components/top-nav": "^1.0.1",

these certainly work with both pnpm and npm. unsure about others.

@lschierer
Copy link
Contributor Author

I'm happy to submit a bug to the Spectrum guys, but the error message from Greenwood doesn't really give me enough detail to know what to submit. I imagine the package is malformed in someway, but I'm not sure what it expects to be a string that its getting an object for instead.

@thescientist13
Copy link
Member

thescientist13 commented Nov 12, 2024

Thanks for this report, though my initial hunch is that this one might be on Greenwood as I ran into something similar when playing around with Shoelace. My plan there, and for this and in general, is to better flesh out our support for package.json exports field.

This kind of work is definitely at the top of our priority queue so give me a little time and then hopefully we can unlock even more support for a much wider set of ecosystem packages.


It might be worth trying to move this dep to devDependencies and use full paths to the dependency file from your code and see if that works as an interim work around (basically bypassing the import map, but depends on how many transitive deps it references🤞 )

@lschierer
Copy link
Contributor Author

cool, well if you need more information, I can try to gather it.

@thescientist13
Copy link
Member

thank you! will keep posted on progress here and let you know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working CLI
Projects
Development

No branches or pull requests

2 participants