节点立即被杀死-MacOS

时间:2020-05-24 22:35:38

标签: node.js macos crash

我一直在尝试调试为什么会发生这种情况以及如何解决它以便我可以工作! 问题看起来像这样:

➜  ~ node
[1]    2912 killed     node

它发生在yarnnpm上,所以我假设它是node。我在node中找不到任何/var/log/system.log提及的内容。 我尝试通过brew重新安装节点,但错误仍然存​​在。我也重新安装了纱。 我还能做些什么来弄清楚为什么这种情况会发生?这是哪里登录的?

顺便说一句:我的内存还没用完,我有可用的内存和硬盘空间

我打开“控制台”实用程序应用程序,并在尝试启动nodejs时发现此错误:

proc 4298: load code signature error 2 for file "node"

谢谢

3 个答案:

答案 0 :(得分:3)

我在新的 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 包(如果你有纱线,你可能也想卸载它)

➜  ~ 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.
>

答案 1 :(得分:1)

我使用的是 M1 Mac Mini。我的解决方案是重新安装 Homebrew。步骤:

  1. 运行官方卸载脚本:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/uninstall.sh)"
  2. 清理:sudo rm -rf /opt/homebrew
  3. 全新安装:/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
  4. brew install node

答案 2 :(得分:0)

已修复

我通过完全删除节点并通过nvm重新安装来解决