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 find module 'poseidon-lite' when npx hardhat test #115

Open
Alexander-Herranz opened this issue Dec 27, 2024 · 1 comment
Open

Cannot find module 'poseidon-lite' when npx hardhat test #115

Alexander-Herranz opened this issue Dec 27, 2024 · 1 comment

Comments

@Alexander-Herranz
Copy link
Contributor

Alexander-Herranz commented Dec 27, 2024

Node.JS installed (tried with v20.18.1, v22.12.0 and v23.5.0)
Chip Apple M3, 16GB memory and macOS Sonoma 14.5

I previously tried both:

export ZETO_NAME=Zeto_AnonEncNullifier
npx hardhat run scripts/deploy_upgradeable.js

and

export ZETO_NAME=Zeto_AnonEncNullifier
npx hardhat run scripts/deploy_cloneable.js

And when trying to execute tests, in both cases I got the same error about poseidon-lite

➜  solidity git:(main) npx hardhat test                               
An unexpected error occurred:

Error: Cannot find module 'poseidon-lite'

Require stack:

/zeto-lab/zeto/zkp/js/index.js
/zeto-lab/zeto/solidity/test/gas_cost/zeto_anon_enc_nullifier_kyc_cost_analysis.ts
/zeto-lab/zeto/solidity/node_modules/mocha/lib/mocha.js
/zeto-lab/zeto/solidity/node_modules/mocha/index.js
/zeto-lab/zeto/solidity/node_modules/hardhat/builtin-tasks/test.js
/zeto-lab/zeto/solidity/node_modules/hardhat/internal/core/tasks/builtin-tasks.js
/zeto-lab/zeto/solidity/node_modules/hardhat/internal/core/config/config-loading.js
/zeto-lab/zeto/solidity/node_modules/hardhat/internal/cli/cli.js
/zeto-lab/zeto/solidity/node_modules/hardhat/internal/cli/bootstrap.js
    at Function.<anonymous> (node:internal/modules/cjs/loader:1249:15)
    at Function.Module._resolveFilename.sharedData.moduleResolveFilenameHook.installedValue [as _resolveFilename] (/zeto-lab/zeto/solidity/node_modules/@cspotcode/source-map-support/source-map-support.js:811:30)
    at Function._load (node:internal/modules/cjs/loader:1075:27)
    at TracingChannel.traceSync (node:diagnostics_channel:322:14)
    at wrapModuleLoad (node:internal/modules/cjs/loader:219:24)
    at Module.require (node:internal/modules/cjs/loader:1340:12)
    at require (node:internal/modules/helpers:138:16)
    at Object.<anonymous> (/Users/alexander/Documents/Alexander/zeto-lab/zeto/zkp/js/index.js:19:18)
    at Module._compile (node:internal/modules/cjs/loader:1565:14)
    at node:internal/modules/cjs/loader:1708:10 {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/zeto-lab/zeto/zkp/js/index.js',
    '/zeto-lab/zeto/solidity/test/gas_cost/zeto_anon_enc_nullifier_kyc_cost_analysis.ts',
    '/zeto-lab/zeto/solidity/node_modules/mocha/lib/mocha.js',
    '/zeto-lab/zeto/solidity/node_modules/mocha/index.js',
    '/zeto-lab/zeto/solidity/node_modules/hardhat/builtin-tasks/test.js',
    '/zeto-lab/zeto/solidity/node_modules/hardhat/internal/core/tasks/builtin-tasks.js',
    '/zeto-lab/zeto/solidity/node_modules/hardhat/internal/core/config/config-loading.js',
    '/zeto-lab/zeto/solidity/node_modules/hardhat/internal/cli/cli.js',
    '/zeto-lab/zeto/solidity/node_modules/hardhat/internal/cli/bootstrap.js'
  ]
@Chengxuan
Copy link
Contributor

Chengxuan commented Dec 29, 2024

@Alexander-Herranz the solidity test uses utility functions in zkp/js folder. Please ensure you've run npm i under that directory.

Please feel free to update the readme if that step is missing.

If you've followed the Readme of the solidity directory, it should have been listed as a pre-req

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

2 participants