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 > sourcemap-codec@1.4.8: Please use @jridgewell/sourcemap-codec instead
[2/4] Fetching packages...
[3/4] Linking dependencies...
warning "@agoric/vats > @agoric/swingset-vat@0.32.3-u13.0" has unmet peer dependency "ava@^5.2.0".
warning "@agoric/vats > @agoric/store > @endo/pass-style > @fast-check/ava@1.2.1" 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/babel-generator@7.17.6
├─ @agoric/inter-protocol@0.16.2-u13.0
├─ @agoric/sharing-service@0.2.12-u13.0
├─ @agoric/swingset-liveslots@0.10.3-u13.0
├─ @agoric/swingset-xsnap-supervisor@0.10.3-u13.0
├─ @agoric/xsnap@0.14.3-u13.0
├─ @babel/code-frame@7.23.5
├─ @babel/generator@7.23.6
├─ @babel/helper-environment-visitor@7.22.20
├─ @babel/helper-function-name@7.23.0
├─ @babel/helper-hoist-variables@7.22.5
├─ @babel/helper-split-export-declaration@7.22.6
├─ @babel/helper-string-parser@7.23.4
├─ @babel/highlight@7.23.4
├─ @babel/parser@7.23.6
├─ @babel/template@7.22.15
├─ @babel/types@7.23.6
├─ @endo/cjs-module-analyzer@0.2.35
├─ @endo/lockdown@0.1.32
├─ @endo/netstring@0.3.26
├─ @endo/ses-ava@0.2.40
├─ @endo/static-module-record@0.7.20
├─ @endo/stream-node@0.2.26
├─ @endo/zip@0.2.35
├─ @fast-check/ava@1.2.1
├─ @jridgewell/gen-mapping@0.3.3
├─ @jridgewell/resolve-uri@3.1.1
├─ @jridgewell/set-array@1.1.2
├─ @jridgewell/sourcemap-codec@1.4.15
├─ @jridgewell/trace-mapping@0.3.22
├─ @rollup/plugin-commonjs@19.0.2
├─ @rollup/plugin-node-resolve@13.3.0
├─ @types/estree@1.0.5
├─ @types/node@20.11.6
├─ @types/resolve@1.17.1
├─ acorn@8.11.3
├─ ansi-styles@6.2.1
├─ balanced-match@1.0.2
├─ base64-js@1.5.1
├─ better-sqlite3@8.7.0
├─ bindings@1.5.0
├─ bl@4.1.0
├─ brace-expansion@1.1.11
├─ buffer@5.7.1
├─ builtin-modules@3.3.0
├─ chownr@1.1.4
├─ color-convert@1.9.3
├─ color-name@1.1.3
├─ commondir@1.0.1
├─ concat-map@0.0.1
├─ debug@4.3.4
├─ decompress-response@6.0.0
├─ deep-extend@0.6.0
├─ deepmerge@4.3.1
├─ detect-libc@2.0.2
├─ end-of-stream@1.4.4
├─ escape-string-regexp@1.0.5
├─ estree-walker@2.0.2
├─ expand-template@2.0.3
├─ fast-check@3.15.0
├─ file-uri-to-path@1.0.0
├─ fs-constants@1.0.0
├─ fs.realpath@1.0.0
├─ function-bind@1.1.2
├─ github-from-package@0.0.0
├─ glob@7.2.3
├─ globals@11.12.0
├─ has-flag@3.0.0
├─ hasown@2.0.0
├─ ieee754@1.2.1
├─ import-meta-resolve@2.2.2
├─ inflight@1.0.6
├─ ini@1.3.8
├─ is-builtin-module@3.2.1
├─ is-core-module@2.13.1
├─ is-module@1.0.0
├─ is-reference@1.2.1
├─ js-tokens@4.0.0
├─ lru-cache@6.0.0
├─ magic-string@0.25.9
├─ microtime@3.1.1
├─ mimic-response@3.1.0
├─ minimatch@3.1.2
├─ minimist@1.2.8
├─ mkdirp-classic@0.5.3
├─ ms@2.1.2
├─ napi-build-utils@1.0.2
├─ node-abi@3.54.0
├─ node-addon-api@5.1.0
├─ node-gyp-build@4.8.0
├─ once@1.4.0
├─ path-is-absolute@1.0.1
├─ path-parse@1.0.7
├─ picomatch@2.3.1
├─ prebuild-install@7.1.1
├─ pure-rand@6.0.4
├─ rc@1.2.8
├─ readable-stream@3.6.2
├─ resolve@1.22.8
├─ rimraf@3.0.2
├─ rollup@2.79.1
├─ safe-buffer@5.2.1
├─ semver@6.3.1
├─ simple-concat@1.0.1
├─ simple-get@4.0.1
├─ source-map@0.5.7
├─ sourcemap-codec@1.4.8
├─ string_decoder@1.3.0
├─ strip-json-comments@2.0.1
├─ supports-color@5.5.0
├─ supports-preserve-symlinks-flag@1.0.0
├─ tar-fs@2.1.1
├─ tar-stream@2.2.0
├─ to-fast-properties@2.0.0
├─ tunnel-agent@0.6.0
├─ undici-types@5.26.5
├─ util-deprecate@1.0.2
└─ yallist@4.0.0
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/vats@0.15.2-u13.0"
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