JairusSW/as-json

asc reports "ERROR TS6054: File '~lib/json-as.ts' not found." after running npm install json-as

Closed this issue · 15 comments

The error report:

> asc assembly/index.ts -b build/untouched.wasm -t build/untouched.wat --use abort=abort_proc_exit --sourceMap --debug

ERROR TS6054: File '~lib/json-as.ts' not found.

 import { JSON, unknown } from 'json-as';
                               ~~~~~~~~~
 in assembly/index.ts(8,31)

And here is the part of the node_modules (json-as) is installed:

 $ tree node_modules/json-as
node_modules/json-as
├── asconfig.json
├── assembly
│   ├── bench.ts
│   ├── json.ts
│   ├── Object.ts
│   ├── test.ts
│   └── unknown.ts
├── bench
│   └── bench.js
├── LICENSE
├── package.json
├── README.md
├── tests
│   ├── index.js
│   └── test.js
└── transform
    ├── index.ts
    ├── lib
    │   └── index.js
    ├── package.json
    └── tsconfig.json

5 directories, 16 files

@spacewander, what version are you using? I believe I just fixed the problem in v2.0.1. I made a typo in the type exports

Thank you for your quick reply.

Hello, I'm having the same issue here. Latest version yarn/npm could find is 0.2.0
Also having trouble running --transform after installation (Windows 10), getting the following error:
'--transform' is not recognized as an internal or external command,
operable program or batch file.
Would appreciate any help, Thanks :)

@mohamedalichelbi Just reopened this issue. I'm currently on a road trip, so i will get back to you tomorrow morning! Thanks for letting me know about this bug!

@mohamedalichelbi, Just updated it! I hope it works now!

@JairusSW Thank you, now I have 0.2.1 but still facing the same problem.
For compiling I'm using asbuild: yarn asb --transform json-as/transform but got same error using asc as well.
you can find my code here, using json-as in assembly/index.ts

@mohamedalichelbi, I'm cloning it atm. I'll test it locally and get back to you with the results asap!

@mohamedalichelbi, I got it working! Apparently, AssemblyScript changed their module import system a bit and I didn't know until now. Anyways, the fix is avaliable in v2.0.4
I'm still working on dynamic objects, but dynamic arrays are working. I'm still working on them, so there will be some breaking changes for dynamic (de)serialization. fyi.

Just run yarn add json-as@latest and it should work.
I used this command to build: yarn asc ./assembly/index.ts --transform json-as/transform -o ./contract.wasm

@JairusSW it's working now, Thank you!

@mohamedalichelbi, Awesome! Glad to hear it! :) Closing this now

@JairusSW Just wondering if we can re-open this, I'm currently facing this issue when using asc.compileString 🤔

image

Sure.

I'm doing a complete rewrite, fyi. Changes coming soon.
Maybe try to add ./node_modules/ in front?

Closing due to inactivity. This shouldn't be a problem anymore either