[英]dyld: lazy symbol binding failed: Symbol not found: _node_module_register
I have tried reinstalling and rebuilding npm, but the problem still persists.我已经尝试重新安装和重建 npm,但问题仍然存在。
Initially, the problem is with the module mongodb
: I don't have that package, so I installed mongodb
using this command npm install mongodb
.最初,问题与模块
mongodb
:我没有这样的包,所以我安装mongodb
使用此命令npm install mongodb
。
It shows me the following error:它向我显示以下错误:
dyld: Symbol not found: _node_module_register
Try deleting your node_modules folder and running npm install again.尝试删除您的 node_modules 文件夹并再次运行 npm install。
rm -rf node_modules/
npm install
That should fix it.那应该解决它。
Basically this error means - some binary packages was built under different node.js versions and not compatible to each other .基本上这个错误意味着 -一些二进制包是在不同的 node.js 版本下构建的,并且彼此不兼容。
node -v
;node -v
;nvm
run npm update
;nvm
安装并切换到正确的 node.js 版本后,运行npm update
;npm rebuild
;npm rebuild
;npm rebuild
might throw errors - just run npm rebuild
again and again until it runs successfully.npm rebuild
可能会抛出错误 - 只需一次又一次地运行npm rebuild
,直到它成功运行。 Note: some commands may ask for root (sudo) permissions, - it depends from how you have installed packages, npm and node itself previously.注意:某些命令可能会要求 root (sudo) 权限,这取决于您之前如何安装包、npm 和节点本身。
nvm
- never needs to be run as root (sudo). nvm
- 永远不需要以 root (sudo) 身份运行。
This is what worked for me:这对我有用:
rm -rf node_modules/
sudo npm install
If you just updated node and are running scripts via WebStorm, make sure you edit your Run/Debug Configurations and update the path to the Node Interpreter.如果您刚刚更新了节点并通过 WebStorm 运行脚本,请确保您编辑了运行/调试配置并更新了节点解释器的路径。 I was using the node in
我在使用节点
/usr/local/bin/node
, but after installing Node 4 using nvm, I need to use ,但是在使用 nvm 安装 Node 4 之后,我需要使用
/path/to/.nvm/v4.2.2/bin/node
Make sure your nvm is pointing to the correct nodejs version.确保您的nvm 指向正确的 nodejs 版本。 For me I used different (higher) while installing the npm modules.
对我来说,我在安装 npm 模块时使用了不同的(更高)。 So just ran
**nvm use** v14.7.0
所以就跑
**nvm use** v14.7.0
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.