as-json icon indicating copy to clipboard operation
as-json copied to clipboard

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

Open mattjohnsonpint opened this issue 1 year ago • 2 comments

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: [email protected]
npm ERR! Found: [email protected]
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 [email protected]
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 avatar Oct 25 '23 01:10 mattjohnsonpint