2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

Symbol SDK v3系をNext.jsプロジェクトで使ったときにエラーに遭遇

Last updated at Posted at 2025-06-25

概要

Symbol SDK v3系をNext.jsプロジェクトで使ったときにエラーが発生しました。

環境

[OS]
Windows 11
WSL2
[Program]
Symbol SDK 3.2.3
Next.js 15.3.3

内容

自分が遭遇したエラーの内容は次のようなものでした。

⨯ ./node_modules/symbol-crypto-wasm-node/symbol_crypto_wasm.js:250:15
 Module not found: Can't resolve 'fs'
  248 |
  249 | const path = require('path').join(__dirname, 'symbol_crypto_wasm_bg.wasm')>
  250 | const bytes = require('fs').readFileSync(path);
      |               ^^^^^^^^^^^^^
  251 |
  252 | const wasmModule = new WebAssembly.Module(bytes);
  253 | const wasmInstance = new WebAssembly.Instance(wasmModule, imports);

これに対してモジュールをインストールするなどを試しましたが改善せず。
最終的にエラーが出なくなった対応方法は node_modules/symbol-sdk/src/impl/ed25519.js を編集するというものでした。

import ed25519_js from './ed25519_js.js';
// import ed25519_wasm from './ed25519_wasm.js';  ここをコメントアウト

let ed25519;
export default {
	get: () => {


		if (!ed25519)
            // ed25519 = globalThis.WebAssembly && !process.env.SYMBOL_SDK_NO_WASM ? ed25519_wasm : ed25519_js;  ここをコメントアウト
            ed25519 = ed25519_js;  // 追記

		return ed25519;
	},
	unload: () => {
		ed25519 = undefined;
	}
};

上記では2か所をコメントアウト、1か所を追記しています。
自分の場合はこれで改善されました。

参照記事 m(__)m
https://qiita.com/ccHarvestasya/items/89afbec1ce1475f1fb83#symbol-sdk-%E3%81%AE-wasm-%E5%8F%82%E7%85%A7%E9%83%A8%E5%88%86%E3%82%92%E5%89%8A%E9%99%A4

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?