node-rs icon indicating copy to clipboard operation
node-rs copied to clipboard

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

Open hotoo opened this issue 2 years ago • 4 comments

macOS Ventura 13.4 (22F66) Apple M2 Pro

/Users/hotoo/Library/pnpm/global/5/.pnpm/@[email protected]/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/@[email protected]/node_modules/@node-rs/jieba/index.js
- /Users/hotoo/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pinyin/lib/segment.js
- /Users/hotoo/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pinyin/lib/pinyin.js
- /Users/hotoo/Library/pnpm/global/5/.pnpm/[email protected]/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/@[email protected]/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/@[email protected]/node_modules/@node-rs/jieba/index.js',
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pinyin/lib/segment.js',
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pinyin/lib/pinyin.js',
    '/Users/hotoo/Library/pnpm/global/5/.pnpm/[email protected]/node_modules/pinyin/bin/pinyin'
  ]
}

hotoo avatar Sep 05 '23 02:09 hotoo

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

Brooooooklyn avatar Sep 05 '23 02:09 Brooooooklyn

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

hotoo avatar Sep 05 '23 05:09 hotoo

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.

Brooooooklyn avatar Sep 05 '23 06:09 Brooooooklyn

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

hotoo avatar Sep 07 '23 08:09 hotoo