节点立即被杀死 - MacOS
Posted
技术标签:
【中文标题】节点立即被杀死 - MacOS【英文标题】:Node gets instantly killed - MacOS 【发布时间】:2020-09-11 13:13:18 【问题描述】:我一直在尝试调试为什么会发生这种情况以及如何修复它以便我可以工作! 问题如下:
➜ ~ node
[1] 2912 killed node
它发生在yarn
和npm
上,所以我假设它是node
。我在/var/log/system.log
中找不到任何node
提及。
我尝试通过 brew 重新安装节点,但错误仍然存在。我也重新安装了纱线。
我还能做些什么来找出为什么会这样?这是在哪里记录的?
顺便说一句:我没有用完内存,我有可用的内存和硬盘空间
我打开“控制台”实用程序,在尝试启动 nodejs 时发现此错误:
proc 4298: load code signature error 2 for file "node"
谢谢
【问题讨论】:
【参考方案1】:已修复
我通过完全删除节点并通过 nvm 重新安装来修复
【讨论】:
你走运了!这对我不起作用 - 花了 15 分钟从源代码编译该节点版本。【参考方案2】:我在新的 Macos Big Sur 上遇到了完全相同的问题,我按照这些步骤解决了这个问题,我希望它能节省别人的时间:
这就是我得到的
➜ ~ node
[1] 12187 killed node
在控制台中我发现错误消息指向 icu4c
CODE SIGNING: process 11193[node]: rejecting invalid page at address 0x1047f4000 from offset 0x0 in file "/opt/homebrew/Cellar/icu4c/67.1/lib/libicui18n.67.1.dylib" (cs_mtime:1614412395.998493416 == mtime:1614412395.998493416) (signed:1 validated:1 tainted:1 nx:0 wpmapped:0 dirty:0 depth:0)
所以我卸载了node和icu4c包(如果你有yarn,你可能也想卸载它)
➜ ~ brew uninstall node
Uninstalling /opt/homebrew/Cellar/node/15.10.0... (3,390 files, 54.9MB)
➜ ~ brew uninstall icu4c
Uninstalling /opt/homebrew/Cellar/icu4c/67.1... (258 files, 72.4MB)
然后我又运行了一个命令,只是为了删除任何不需要的东西。
brew cleanup
之后我运行了brew install node
,它开始工作了!
这是来自我的终端的日志:
➜ ~ brew install node
==> Downloading https://homebrew.bintray.com/bottles/icu4c-67.1.arm64_big_sur.bo
Already downloaded: /Users/pgoca/Library/Caches/Homebrew/downloads/0ead47d11680c7b6ed4d76eb2a934878314e34e9ac979b5306b6fb7a1ac3f8ae--icu4c-67.1.arm64_big_sur.bottle.tar.gz
==> Downloading https://homebrew.bintray.com/bottles/node-15.10.0.arm64_big_sur.
Already downloaded: /Users/pgoca/Library/Caches/Homebrew/downloads/5e38af944729bd333a4217bf8327099595ebec3a5e7c5eb1029399555828e39b--node-15.10.0.arm64_big_sur.bottle.tar.gz
==> Installing dependencies for node: icu4c
==> Installing node dependency: icu4c
==> Pouring icu4c-67.1.arm64_big_sur.bottle.tar.gz
==> Caveats
icu4c is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"
==> Summary
? /opt/homebrew/Cellar/icu4c/67.1: 258 files, 72.4MB
==> Installing node
==> Pouring node-15.10.0.arm64_big_sur.bottle.tar.gz
? /opt/homebrew/Cellar/node/15.10.0: 3,390 files, 54.9MB
==> Caveats
==> icu4c
icu4c is keg-only, which means it was not symlinked into /opt/homebrew,
because macOS provides libicucore.dylib (but nothing else).
If you need to have icu4c first in your PATH, run:
echo 'export PATH="/opt/homebrew/opt/icu4c/bin:$PATH"' >> ~/.zshrc
echo 'export PATH="/opt/homebrew/opt/icu4c/sbin:$PATH"' >> ~/.zshrc
For compilers to find icu4c you may need to set:
export LDFLAGS="-L/opt/homebrew/opt/icu4c/lib"
export CPPFLAGS="-I/opt/homebrew/opt/icu4c/include"
➜ ~ node
Welcome to Node.js v15.10.0.
Type ".help" for more information.
>
【讨论】:
【参考方案3】:我使用的是 M1 Mac Mini。我的解决方案是重新安装 Homebrew。步骤:
-
运行官方卸载脚本:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
清理:sudo rm -rf /opt/homebrew
全新安装:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install node
【讨论】:
我正在经历这个,但意识到我使用 n 或 nvm 来管理节点版本。如果你也在做同样的事情,上面只会削弱你的 brew 包而不修复任何东西。以上是关于节点立即被杀死 - MacOS的主要内容,如果未能解决你的问题,请参考以下文章
2021-08-12:约瑟夫环问题。给定一个链表头节点head,和一个正数m,从头开始,每次数到m就杀死当前节点 ,然后被杀节点的下一个节点从1开始重新数, 周而复始直到只剩一个节点,返回最后的节点。