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

Cannot create property 'pos' when used with Capnproto 1.0 compiler #178

Open
dattanchu opened this issue Aug 7, 2023 · 4 comments
Open

Comments

@dattanchu
Copy link

When I run capnp compiler of Capnproto 1.0 version, I am getting

TypeError: Cannot create property 'pos' on string 'AppContext_DeviceOrientation'
    at setTextRangePos (/private/var/tmp/.../node_modules/typescript/lib/typescript.js:21342:19)
    at Object.setTextRangePosEnd (/private/var/tmp/.../node_modules/typescript/lib/typescript.js:21360:32)
    at createNodeArray (/private/var/tmp/.../node_modules/typescript/lib/typescript.js:22985:16)
    at Object.createEnumDeclaration (/private/var/tmp/.../node_modules/typescript/lib/typescript.js:25548:28)
    at Object.createEnumDeclaration (/private/var/tmp/.../node_modules/typescript/lib/typescript.js:3138:29)
    at generateEnumNode (/private/var/tmp/.../node_modules/capnpc-ts/src/generators.js:117:36)
    at generateNode (/private/var/tmp/.../node_modules/capnpc-ts/src/generators.js:159:13)
    at /private/var/tmp/.../node_modules/capnpc-ts/src/generators.js:148:32
    at Array.forEach (<anonymous>)
    at Object.generateNode (/private/var/tmp/.../node_modules/capnpc-ts/src/generators.js:148:17)

This happens for all .capnp files. The command that I use to run is

bin/external/capnproto/capnp compile --verbose --no-standard-import -o./node_modules/capnpc-js/bin/capnpc-js.js:bazel-out/darwin_arm64-fastbuild/bin -Iexternal/capnproto/c++/src -Ithird_party/capnpcs/compiler -Iexternal/capnproto_java/compiler/src/main/schema .../app.capnp

Any tips on how I can help debug this issue? Has anyone tried the latest capnproto version with capnp-ts? I tried running my C++ only executables and they run ok.

@Doris0812
Copy link

Have you solved it now?

@dattanchu
Copy link
Author

I have not solved the issue. I believe the error is a red herring. Something has changed in capnpc 1.0 and this breaks capnp-ts.

@bartoszflis-silvair
Copy link

I've fixed a Cannot create property 'pos' on string error by using the following config in package.json. Used capnpc 0.7.0 though, so YMMV.

  "engines": {
    "node": "<=23",
    "npm": ">8.4"
  },
  "dependencies": {
    "@types/debug": "^4.1.12",
    "capnpc-js": "0.5.1",
    "capnpc-ts": "0.7.0",
    "ts-node": "~7.0.0",
    "typescript": "<4"
  },
  "overrides": {
    "typescript": "$typescript"
  }

@shestakov-bc
Copy link

In my case it worked with capnpc 0.8.0 which is bundled by default with Ubuntu 22.04. I did also tried manually built 0.7.0, and got same results. It only worked with package "capnpc-ts": "0.4.0". Even 0.5.0 would throw same error. Trying different version of typescript or ts-node wouldn't change a thing for me. I hope it will unlock someone sooner, I lost half a day with this.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants