ProvableHQ / sdk

A Software Development Kit (SDK) for Zero-Knowledge Transactions
https://provable.tools
GNU General Public License v3.0
593 stars 471 forks source link

[Bug] Having error with latest create-leo-app #941

Open zklimaleo opened 1 month ago

zklimaleo commented 1 month ago

🐛 Bug Report

Follow guide to run create-leo-app but encounter error during run dev. Noticed the update of @provablehq/sdk to 0.7.0. Fallback to 0.6.13 works.

Steps to Reproduce

Code snippet to reproduce

npm create leo-app@latest
cd aleo-project
npm install
npm run dev

Stack trace & error message

Failed to resolve import "core-js/proposals/json-parse-with-source.js" from "node_modules/@provablehq/sdk/dist/testnet/browser.js?v=cc7fe778". Does the file exist?
6:05:15 PM [vite] Internal server error: Failed to resolve import "core-js/proposals/json-parse-with-source.js" from "node_modules/@provablehq/sdk/dist/testnet/browser.js?v=cc7fe778". Does the file exist?
  Plugin: vite:import-analysis
  File: /aleo-project/node_modules/@provablehq/sdk/dist/testnet/browser.js?v=cc7fe778:1:9
  1  |  import 'core-js/proposals/json-parse-with-source.js';
     |          ^
  2  |  import { ViewKey, Address, PrivateKeyCiphertext, PrivateKey, RecordCiphertext, Program, Transaction, ProvingKey, VerifyingKey, ProgramManager as ProgramManager$1, RecordPlaintext, verifyFunctionExecution, Metadata } from '@provablehq/wasm/testnet.js';
  3  |  export { Address, ExecutionResponse, Field, Execution as FunctionExecution, OfflineQuery, PrivateKey, PrivateKeyCiphertext, Program, ProgramManager as ProgramManagerBase, ProvingKey, RecordCiphertext, RecordPlaintext, Signature, Transaction, VerifyingKey, ViewKey, initThreadPool, verifyFunctionExecution } from '@provablehq/wasm/testnet.js';

Expected Behavior

Able to run dev without errors

Your Environment

Neo-Gar commented 1 month ago

Same issue

RevelationOfTuring commented 1 week ago

Same issue

d0cd commented 6 days ago

For context, this error only occurs when I run npm create leo-app@latest and select Node.js as the framework

iamalwaysuncomfortable commented 2 days ago

@Pauan any idea why this might be?

zkxuerb commented 1 day ago

This issue also occurs when running npm create leo-app@latest with React, and then building the project using npm run build.

d0cd commented 1 day ago

For the React option, I was able to get npm run build working after installing core-js. For the Typescript option, I get this error when I get this error

> npm run dev
npm error Missing script: "dev"
npm error
npm error To see a list of scripts, run:
npm error   npm run
npm error A complete log of this run can be found in: /Users/pranav/.npm/_logs/2024-11-27T16_16_51_580Z-debug-0.log
zklimaleo commented 1 day ago

For the React option, I was able to get npm run build working after installing core-js. For the Typescript option, I get this error when I get this error

> npm run dev
npm error Missing script: "dev"
npm error
npm error To see a list of scripts, run:
npm error   npm run
npm error A complete log of this run can be found in: /Users/pranav/.npm/_logs/2024-11-27T16_16_51_580Z-debug-0.log

There's some errors printed in console and all functions from worker.js doesn't work even after installed core-js package for React option

Screenshot 2024-11-28 at 12 54 19 AM
Pauan commented 1 day ago

Thanks for the report, this seems to be caused by #925, I think we just need to update the examples.