node 环境使用 brew 安装,在终端包括其他 node 项目是正常使用,唯独在小程序开发者工具出现错误,当然我的俩个 macOS 设备都会出现这样的问题:
env: node: No such file or directory (anonymous) @ VM90:1
调试器调试信息:
[2021-04-22 20:17:40.237] [ERROR] [/core.wxvpkg/4f295fb24817b74309b6a10cb2876b3d.js] before compile fail after 19ms;catch error: 127 write @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/0b6e4b3dce6396a86cf6febb45c187c3.js:7 (anonymous) @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/17cc688efc2a8e47d91fdb2900a9d684.js:130 Log.write @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/17cc688efc2a8e47d91fdb2900a9d684.js:129 Log.formattedError @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/17cc688efc2a8e47d91fdb2900a9d684.js:59 Log.error @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/17cc688efc2a8e47d91fdb2900a9d684.js:56 (anonymous) @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/4f295fb24817b74309b6a10cb2876b3d.js:2 processTicksAndRejections @ node:internal/process/task_queues:93 Promise.catch (async) module.exports @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/4f295fb24817b74309b6a10cb2876b3d.js:2 apply @ VM1165 lazy-require.js:44 (anonymous) @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/6bb292016bb562d1abc8f84dc151a082.js:2 async function (async) (anonymous) @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/6bb292016bb562d1abc8f84dc151a082.js:2 (anonymous) @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/node_modules.wxvpkg/redux-thunk/lib/index.js:11 rebuildImmediate @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/247bd999b9436d6ce5e8f2714e00644f.js:2 (anonymous) @ /Applications/wechatwebdevtools.app/Contents/Resources/package.nw/core.wxvpkg/247bd999b9436d6ce5e8f2714e00644f.js:2 listOnTimeout @ node:internal/timers:555 processTimers @ node:internal/timers:498
环境如下 macOS big sur 11.2.3:
jaxson@iHome:~ » brew -v
Homebrew 3.1.2
Homebrew/homebrew-core (git revision 8b6131e55a; last commit 2021-04-17)
jaxson@iHome:~ » node -v
v14.16.1
jaxson@iHome:~ » npm -v
6.14.12
jaxson@iHome:~ » where node
/usr/local/opt/node@14/bin/node
jaxson@iHome:~ »
环境变量问题,参考这个:
https://developers.weixin.qq.com/community/develop/doc/000c8284bd43786f4c28cd34c5bc00?_at=1568277487538&jumpto=comment&commentid=000a0cf2160760646d6845535510