NPM fatal error: 'errno.h' file not found #741

遇到的错误提示


Installing assert-plus@^1.0.0  CXX(target) Release/obj.target/node_sleep/sleep.o
In file included from ../sleep.cc:2:
In file included from ../../_nan@2.7.0@nan/nan.h:48:
In file included from /Users/haohao/.node-gyp/6.11.5/include/node/uv.h:48:
/Users/haohao/.node-gyp/6.11.5/include/node/uv-errno.h:25:10: fatal error: 'errno.h' file not found
#include <errno.h>
         ^~~~~~~~~



解决方法

重新安装CommandLineTools工具

  • rm -rf /Library/Developer/CommandLineTools
  • xcode-select --install
xcode-select: note: install requested for command line developer tools

点击安装开始下载安装Xcode Command Line Tools

验证下是否安装成功

  • xcode-select -p
/Applications/Xcode.app/Contents/Developer
  • gcc --version
Configured with: --prefix=/Applications/Xcode.app/Contents/Developer/usr --with-gxx-include-dir=/usr/include/c++/4.2.1
Apple LLVM version 9.0.0 (clang-900.0.38)
Target: x86_64-apple-darwin16.7.0
Thread model: posix
InstalledDir: /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin

这样应该就能解决问题了

©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容