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

@agoric/vats package missing index.js #8809

Closed
dckc opened this issue Jan 24, 2024 · 1 comment · Fixed by #8815
Closed

@agoric/vats package missing index.js #8809

dckc opened this issue Jan 24, 2024 · 1 comment · Fixed by #8815
Assignees
Labels
bug Something isn't working

Comments

@dckc
Copy link
Member

dckc commented Jan 24, 2024

Describe the bug

Using @agoric/vats from npm fails with ERR_MODULE_NOT_FOUND.

To Reproduce

Steps to reproduce the behavior:

  1. yarn add @agoric/vats in an empty project dir
  2. set "type": "module" in package.json
  3. try to import x from '@agoric/vats'
  4. kerflewey. blammo. no joy.

Expected behavior

@agoric/vats presents the same API when installed from npm as it does when linked.

Platform Environment

  • what OS are you using? what version of Node.js?
$ uname -a
Linux bldbox 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux

$ yarn node -v
v18.17.1
  • is there anything special/unusual about your platform?
  • what version of the Agoric-SDK are you using? (run git describe --tags --always)

n/a

0.15.2-u13.0 is the version of @agoric/vats

Terminal Session

IOU some edits

raw terminal session
~/projects
09:42 connolly@bldbox$ mkdir bug1
~/projects
09:42 connolly@bldbox$ cd bug1
~/projects/bug1
09:42 connolly@bldbox$ yarn add @agoric/vats
yarn add v1.22.21
info No lockfile found.
[1/4] Resolving packages...
warning @agoric/vats > @agoric/swingset-vat > @endo/bundle-source > @rollup/plugin-commonjs > magic-string > [email protected]: Please use @jridgewell/sourcemap-codec instead
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@agoric/vats > @agoric/[email protected]" has unmet peer dependency "ava@^5.2.0".
warning "@agoric/vats > @agoric/store > @endo/pass-style > @fast-check/[email protected]" has unmet peer dependency "ava@^4 || ^5 || ^6".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 118 new dependencies.
info Direct dependencies
info All dependencies
├─ @agoric/[email protected]
├─ @agoric/[email protected]
├─ @agoric/[email protected]
├─ @agoric/[email protected]
├─ @agoric/[email protected]
├─ @agoric/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @babel/[email protected]
├─ @endo/[email protected]
├─ @endo/[email protected]
├─ @endo/[email protected]
├─ @endo/[email protected]
├─ @endo/[email protected]
├─ @endo/[email protected]
├─ @endo/[email protected]
├─ @fast-check/[email protected]
├─ @jridgewell/[email protected]
├─ @jridgewell/[email protected]
├─ @jridgewell/[email protected]
├─ @jridgewell/[email protected]
├─ @jridgewell/[email protected]
├─ @rollup/[email protected]
├─ @rollup/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ @types/[email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
├─ [email protected]
└─ [email protected]
Done in 50.92s.
~/projects/bug1
09:43 connolly@bldbox$ yarn node
yarn node v1.22.21
warning package.json: No license field
Welcome to Node.js v18.17.1.
Type ".help" for more information.
> const v = await import('@agoric/vats')
Uncaught:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/home/connolly/projects/bug1/node_modules/@agoric/vats/' imported from /home/connolly/projects/bug1/repl
    at __node_internal_captureLargerStackTrace (node:internal/errors:496:5)
    at new NodeError (node:internal/errors:405:5)
    at legacyMainResolve (node:internal/modules/esm/resolve:233:9)
    at packageResolve (node:internal/modules/esm/resolve:874:14)
    at moduleResolve (node:internal/modules/esm/resolve:936:20)
    at defaultResolve (node:internal/modules/esm/resolve:1129: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 ESMLoader.import (node:internal/modules/esm/loader:524:22)
    at importModuleDynamically (node:repl:506:47)
    at importModuleDynamicallyWrapper (node:internal/vm/module:429:21)
    at importModuleDynamicallyCallback (node:internal/process/esm_loader:35:14)
    at REPL1:1:23 {
  code: 'ERR_MODULE_NOT_FOUND'
}
> 
Done in 22.68s.
~/projects/bug1
09:44 connolly@bldbox$ grep main node_modules/@agoric/vat
vat-data/ vats/     
~/projects/bug1
09:44 connolly@bldbox$ grep main node_modules/@agoric/vats/package.json 
  "main": "./index.js",
~/projects/bug1
09:44 connolly@bldbox$ ls node_modules/@agoric/vats/index.json
ls: cannot access 'node_modules/@agoric/vats/index.json': No such file or directory
~/projects/bug1
09:44 connolly@bldbox$ ls node_modules/@agoric/vats/tools
authorityViz.d.ts      bank-utils.d.ts.map   board-utils.js            viz.mk
authorityViz.d.ts.map  bank-utils.js         boot-test-utils.d.ts
authorityViz.js        board-utils.d.ts      boot-test-utils.d.ts.map
bank-utils.d.ts        board-utils.d.ts.map  boot-test-utils.js
~/projects/bug1
09:44 connolly@bldbox$ vi bug1.js
~/projects/bug1
09:47 connolly@bldbox$ yarn node bug1.js
yarn node v1.22.21
warning package.json: No license field
(node:4059253) Warning: To load an ES module, set "type": "module" in the package.json or use the .mjs extension.
(Use `node --trace-warnings ...` to show where the warning was created)
/home/connolly/projects/bug1/bug1.js:1
import x from '@agoric/vats';
^^^^^^

SyntaxError: Cannot use import statement outside a module
    at internalCompileFunction (node:internal/vm:73:18)
    at wrapSafe (node:internal/modules/cjs/loader:1178:20)
    at Module._compile (node:internal/modules/cjs/loader:1220:27)
    at Module._extensions..js (node:internal/modules/cjs/loader:1310:10)
    at Module.load (node:internal/modules/cjs/loader:1119:32)
    at Module._load (node:internal/modules/cjs/loader:960:12)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
    at node:internal/main/run_main_module:23:47

Node.js v18.17.1
error Command failed.
Exit code: 1
Command: /home/connolly/.nvm/versions/node/v18.17.1/bin/node
Arguments: bug1.js
Directory: /home/connolly/projects/bug1
Output:

info Visit https://yarnpkg.com/en/docs/cli/node for documentation about this command.
~/projects/bug1
09:47 connolly@bldbox$ yarn node b^C1.js
~/projects/bug1
09:47 connolly@bldbox$ vi package.json 
~/projects/bug1
09:48 connolly@bldbox$ yarn node bug1.js
yarn node v1.22.21
warning package.json: No license field
node:internal/errors:496
    ErrorCaptureStackTrace(err);
    ^

Error [ERR_MODULE_NOT_FOUND]: Cannot find package '/home/connolly/projects/bug1/node_modules/@agoric/vats/' imported from /home/connolly/projects/bug1/bug1.js
    at new NodeError (node:internal/errors:405:5)
    at legacyMainResolve (node:internal/modules/esm/resolve:233:9)
    at packageResolve (node:internal/modules/esm/resolve:874:14)
    at moduleResolve (node:internal/modules/esm/resolve:936:20)
    at defaultResolve (node:internal/modules/esm/resolve:1129: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) {
  code: 'ERR_MODULE_NOT_FOUND'
}

Node.js v18.17.1
error Command failed.
Exit code: 1
Command: /home/connolly/.nvm/versions/node/v18.17.1/bin/node
Arguments: bug1.js
Directory: /home/connolly/projects/bug1
Output:

info Visit https://yarnpkg.com/en/docs/cli/node for documentation about this command.
~/projects/bug1
09:48 connolly@bldbox$ cat package.json 
{
"type":"module",
  "dependencies": {
    "@agoric/vats": "^0.15.2-u13.0"
  }
}
~/projects/bug1
09:50 connolly@bldbox$ cat bug1.js
import x from '@agoric/vats';

~/projects/bug1
09:50 connolly@bldbox$ uname -a
Linux bldbox 5.15.0-91-generic #101-Ubuntu SMP Tue Nov 14 13:30:08 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
~/projects/bug1
09:51 connolly@bldbox$ yarn node -v
yarn node v1.22.21
warning package.json: No license field
v18.17.1
Done in 0.02s.
~/projects/bug1
09:51 connolly@bldbox$ git describe --tags --always
fatal: not a git repository (or any of the parent directories): .git

~/projects/bug1
09:51 connolly@bldbox$ yarn why @agoric/vats
yarn why v1.22.21
warning package.json: No license field
[1/4] Why do we have the module "@agoric/vats"...?
[2/4] Initialising dependency graph...
warning No license field
[3/4] Finding dependency...
[4/4] Calculating file sizes...
=> Found "@agoric/[email protected]"
info Has been hoisted to "@agoric/vats"
info Reasons this module exists
   - Specified in "dependencies"
   - Hoisted from "@agoric#vats#@agoric#governance#@agoric#vats"
   - Hoisted from "@agoric#vats#@agoric#inter-protocol#@agoric#vats"
info Disk size without dependencies: "1.18MB"
info Disk size with unique dependencies: "11.8MB"
info Disk size with transitive dependencies: "325.22MB"
info Number of shared dependencies: 12
Done in 0.28s.
@dckc dckc added the bug Something isn't working label Jan 24, 2024
@mhofman mhofman self-assigned this Jan 25, 2024
@dckc
Copy link
Member Author

dckc commented Jan 25, 2024

FYI... agoric-labs/dapp-swaparoo@0a94313 is a patch in swaparoo for this

likewise @agoric+vats+0.15.2-u12.0.patch

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

Successfully merging a pull request may close this issue.

2 participants