错误:root:未找到哈希 md5 的代码。npm安装出错

Aru*_*ran 13 javascript python node.js npm webpack

ERROR:root:code for hash md5 was not found在 StackOverflow 中发现了一些带有标题标签的类似问题,但我无法将它与我在 npm 安装过程中此时面临的问题联系起来。

我使用的是 macOS High Sierra (10.13.6)

带有节点版本v8.0.0和 npmv5.0.0

我在尝试将 Webpack 安装到我的项目中时收到以下错误消息。

npm install --save-dev webpack webpack-dev-server webpack-cli

> node-gyp rebuild

ERROR:root:code for hash md5 was not found.
Traceback (most recent call last):

ValueError: unsupported hash type md5
ERROR:root:code for hash sha1 was not found.
Run Code Online (Sandbox Code Playgroud)

我试图将我的 node 和 npm 版本分别切换到 v12.0.0 和 v6.9.0,但它遵循相同的错误。

有没有人对此有任何想法?如何解决这个问题?我觉得它应该更像是一个配置,而不是一个特定的包安装。

在此先感谢您的帮助!

附加信息:

我在继续 python version: 2.7.16

更新:

我刚刚观察到在我的系统中安装所有 npm 都会出现相同的错误。

遵循这个问题和解决方法,它在堆栈中引入了一个不同的错误:

> node-gyp rebuild

  xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  xcode-select: error: tool 'xcodebuild' requires Xcode, but active developer directory '/Library/Developer/CommandLineTools' is a command line tools instance

  xcode_version, _ = XcodeVersion()
  File"/Users/arunkramachandran/.nvm/versions/node/v8.0.0/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/xcode_emulation.py", line 1265, in XcodeVersion
Run Code Online (Sandbox Code Playgroud)

小智 10

如果您遵循此修复程序会发生什么?节点gyp问题

编辑:根据 Blackfurnace 的建议进行编辑。

如果您遇到的问题与 node-gyp 相关,则以下命令应该可以解决它:

xcode-select --install # Install Command Line Tools if you haven't already.
sudo xcode-select --switch /Library/Developer/CommandLineTools # Enable command line tools
Run Code Online (Sandbox Code Playgroud)