napi-rs / node-rs

Node.js bindings ❤️ Rust crates
https://node-rs.dev
MIT License
1.06k stars 32 forks source link

M2 macOS:Cannot find module '@node-rs/jieba-darwin-x64' #713

Open hotoo opened 10 months ago

hotoo commented 10 months ago

macOS Ventura 13.4 (22F66) Apple M2 Pro

/Users/hotoo/Library/pnpm/global/5/.pnpm/@node-rs+jieba@1.7.2/node_modules/@node-rs/jieba/index.js:232
    throw loadError
    ^

Error: Cannot find module '@node-rs/jieba-darwin-x64'
Require stack:
- /Users/hotoo/Library/pnpm/global/5/.pnpm/@node-rs+jieba@1.7.2/node_modules/@node-rs/jieba/index.js
- /Users/hotoo/Library/pnpm/global/5/.pnpm/pinyin@3.0.0-alpha.5/node_modules/pinyin/lib/segment.js
- /Users/hotoo/Library/pnpm/global/5/.pnpm/pinyin@3.0.0-alpha.5/node_modules/pinyin/lib/pinyin.js
- /Users/hotoo/Library/pnpm/global/5/.pnpm/pinyin@3.0.0-alpha.5/node_modules/pinyin/bin/pinyin
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:931:15)
    at Function.Module._load (internal/modules/cjs/loader.js:774:27)
    at Module.require (internal/modules/cjs/loader.js:1003:19)
    at require (internal/modules/cjs/helpers.js:107:18)
    at Object.<anonymous> (/Users/hotoo/Library/pnpm/global/5/.pnpm/@node-rs+jieba@1.7.2/node_modules/@node-rs/jieba/index.js:121:29)
    at Module._compile (internal/modules/cjs/loader.js:1114:14)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1143:10)
    at Module.load (internal/modules/cjs/loader.js:979:32)
    at Function.Module._load (internal/modules/cjs/loader.js:819:12)
    at Module.require (internal/modules/cjs/loader.js:1003:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/@node-rs+jieba@1.7.2/node_modules/@node-rs/jieba/index.js',
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/pinyin@3.0.0-alpha.5/node_modules/pinyin/lib/segment.js',
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/pinyin@3.0.0-alpha.5/node_modules/pinyin/lib/pinyin.js',
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/pinyin@3.0.0-alpha.5/node_modules/pinyin/bin/pinyin'
  ]
}
Brooooooklyn commented 10 months ago

Are you running an x64 Node.js on arm64 macOS?

hotoo commented 10 months ago

I was download node.js by https://nodejs.org/dist/latest-v14.x/node-v14.21.3.pkg from nodejs.org homepage.

Brooooooklyn commented 10 months ago

Node.js 14 doesn't support arm64 macOS, so you are using the x64 Node.js on arm64 macOS. And the ` Error: Cannot find module '@node-rs/jieba-darwin-x64' may be due to the bug of pnpm, it doesn't install the right binaries for you.

hotoo commented 10 months ago

@Brooooooklyn My company FE framework need me to use node 14, what can I do now?