bitcoinjs / tiny-secp256k1

A tiny secp256k1 native/JS wrapper
MIT License
92 stars 55 forks source link

Can't run React example #85

Closed Janaka-Steph closed 2 years ago

Janaka-Steph commented 2 years ago

Getting this error trying to run the example

Screenshot 2022-05-17 at 12 35 15
junderw commented 2 years ago

You have to build the main package first, then cd into the example, npm ci, then npm start.

From the root:

(note: you must have rust (cargo, rustc, rustup) installed and the wasm32-unknown-unknown target installed, as well as wasm-opt (part of the binaryen package)

$ make build
$ cd examples/react-app/
$ npm ci
$ npm start
Janaka-Steph commented 2 years ago

make build fails printing

rm -rf \
                .nyc_output \
                coverage \
                examples/react-app/dist/*.js \
                examples/react-app/dist/*.txt \
                examples/react-app/dist/*.wasm \
                lib \
                tests/browser
npx tsc && \
        sed -i -e 's/\.\/wasm_path\.js/.\/wasm_path_cjs.js/g' ./src_ts/wasm_loader.ts && \
        npx tsc -p tsconfig-cjs.json && \
        sed -i -e 's/\.\/wasm_path_cjs\.js/.\/wasm_path.js/g' ./src_ts/wasm_loader.ts && \
        for f in ./lib/cjs/*.js; do mv -- "$f" "${f%.js}.cjs"; done && \
        for f in ./lib/cjs/*.cjs; do sed -i -e 's/\(require(".*\)\.js");/\1.cjs");/g' -- "$f"; done
sed: --: No such file or directory
sed: --: No such file or directory
sed: --: No such file or directory
sed: --: No such file or directory
sed: --: No such file or directory
sed: --: No such file or directory
sed: --: No such file or directory
sed: --: No such file or directory
make: *** [build-js] Error 1
▶ rustup show      
Default host: aarch64-apple-darwin
rustup home:  /Users/stephane/.rustup

installed toolchains
--------------------

stable-aarch64-apple-darwin (default)
1.57.0-aarch64-apple-darwin

installed targets for active toolchain
--------------------------------------

aarch64-apple-darwin
wasm32-unknown-unknown

active toolchain
----------------

stable-aarch64-apple-darwin (default)
rustc 1.60.0 (7737e0b5c 2022-04-04)
junderw commented 2 years ago

perhaps it's an issue with sed vs. gsed.

I don't have a Mac to test.