#Unable to import the ZkProgram from o1js
27 messages · Page 1 of 1 (latest)
So, I am importing from here : import { ZkProgram } from 'o1js/dist/node/lib/proof_system';
But while compiling I am getting the following issue:
I am on this version.
@deft cedar
Seriously dude you trying to scam me ?
Username: harmonica4539
User ID: 1084850830672404540
@manic marlin
He's gone, thanks!
NP
@deft cedar
import { ZkProgram } from "o1js";
Still gives same error
Check your tsconfig.json. It should have options like those:
"compilerOptions": {
"target": "es2021" /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019', 'ES2020', 'ES2021', or 'ESNEXT'. */,
"lib": ["es2021", "dom"],
"module": "commonjs" /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', 'es2020', or 'ESNext'. */,
"outDir": "./dist/lib/ts" /* Redirect output structure to the directory. */,
"strict": true /* Enable all strict type-checking options. */,
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */,
"skipLibCheck": true /* Skip type checking of declaration files. */,
"forceConsistentCasingInFileNames": true /* Disallow inconsistently-cased references to the same file. */,
"composite": true,
"resolveJsonModule": true,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"strictPropertyInitialization": false
},
I can see this:
{
"compilerOptions": {
"target": "es2020",
"module": "es2022",
"lib": ["dom", "esnext"],
"outDir": "./build",
"rootDir": ".",
"strict": true,
"strictPropertyInitialization": false, // to enable generic constructors, e.g. on CircuitValue
"skipLibCheck": true,
"forceConsistentCasingInFileNames": true,
"esModuleInterop": true,
"moduleResolution": "node",
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"allowJs": true,
"declaration": true,
"sourceMap": true,
"noFallthroughCasesInSwitch": true,
"allowSyntheticDefaultImports": true
},
"include": ["./src"]
}
Should I change it ?
Yes, you can try to change options and see if it will help or not. Also, if you use yarn, it can be the result of PnP
Also, try to move o1js from peerDependencies to dependencies
Oh okay
and fresh npm install after removing all npm files can also help
I would put the 0.14.1 or 0.14.2
Okay will try with 0.14.1 if still didn't worked will try with .2
Thanks alot.
Let me try and share if it works or not
I've upgraded today typescript dependencies and have got similar errors for jest, o1js, etc...
Downgraded the typescript back, and now everything is working again. Those are my versions:
? Pick the packages you want to upgrade. Current Range Latest
> @types/jest --------------------------------- ◉ ^29.5.8 ------ ◯ ^29.5.10 -----
@typescript-eslint/eslint-plugin ------------ ◉ ^6.10.0 ------ ◯ ^6.12.0 ------
@typescript-eslint/parser ------------------- ◉ ^6.10.0 ------ ◯ ^6.12.0 ------
axios --------------------------------------- ◉ ^1.6.1 ------- ◯ ^1.6.2 -------
eslint -------------------------------------- ◉ ^8.53.0 ------ ◯ ^8.54.0 ------
prettier ------------------------------------ ◉ 3.0.3 -------- ◯ 3.1.0 --------
typescript ---------------------------------- ◉ 5.2.2 -------- ◯ 5.3.2 --------
Oh Okay.
Have you put a name to your zk program