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

Error ... Cannot find package 'visitor-as' #50

Open
mattjohnsonpint opened this issue Oct 25, 2023 · 2 comments
Open

Error ... Cannot find package 'visitor-as' #50

mattjohnsonpint opened this issue Oct 25, 2023 · 2 comments
Labels
closed Closed issues, still displayed good first issue Good for newcomers

Comments

@mattjohnsonpint
Copy link
Contributor

Steps to reproduce:

  • In a new empty directory, create a new AssemblyScript project .
  • Run npm run asbuild - it should compile without error
  • Run npm install json-as
  • Modify asconfig.json to add "transform": ["json-as/transform"] to the existing options section
  • Run npm run asbuild again - it fails with:

FAILURE Error [ERR_MODULE_NOT_FOUND]: Cannot find package 'visitor-as' imported from /<projectdir>/node_modules/json-as/transform/lib/index.js
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at packageResolve (node:internal/modules/esm/resolve:890:9)
    at moduleResolve (node:internal/modules/esm/resolve:939:20)
    at defaultResolve (node:internal/modules/esm/resolve:1132:11)
    at nextResolve (node:internal/modules/esm/loader:163:28)
    at ESMLoader.resolve (node:internal/modules/esm/loader:835:30)
    at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
    at link (node:internal/modules/esm/module_job:76:36)

Tried manually installing with npm install visitor-as --save-dev, but that gives:

npm ERR! code ERESOLVE
npm ERR! ERESOLVE unable to resolve dependency tree
npm ERR! 
npm ERR! While resolving: astmp@1.0.0
npm ERR! Found: assemblyscript@0.27.14
npm ERR! node_modules/assemblyscript
npm ERR!   dev assemblyscript@"^0.27.14" from the root project
npm ERR! 
npm ERR! Could not resolve dependency:
npm ERR! peer assemblyscript@"^0.25.0" from visitor-as@0.11.4
npm ERR! node_modules/visitor-as
npm ERR!   dev visitor-as@"*" from the root project
npm ERR! 
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.

It does work if I use --force, but I shouldn't have to do that.

Not sure if this is a problem with as-json, or with visitor-as, or both.

Thanks.

@mattjohnsonpint
Copy link
Contributor Author

To clarify, if I use --force or --legacy-peer-deps, it adds visitor-as to the devDependencies section correctly, but future calls to npm install (such as on a fresh clone of my project repo) still fail with the same message.

As a workaround, this seems to do the trick:

{
 "dependencies": {
     "json-as": "^0.5.65"
  },
  "devDependencies": {
    "assemblyscript": "^0.27.14",
    "visitor-as": "^0.11.4"
  },
  "overrides": {
    "assemblyscript": "$assemblyscript"
  }
}

With that override, now my npm install works without giving an error.

@JairusSW
Copy link
Owner

Got it. Yeah that's just how NPM works sometimes and is a problem with visitor-as' deps

@JairusSW JairusSW added good first issue Good for newcomers closed Closed issues, still displayed labels Jun 20, 2024
@JairusSW JairusSW reopened this Jun 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
closed Closed issues, still displayed good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants