You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

macOS High Sierra下Node安装Iionic报错求助

Fixing Ionic Installation Failures on macOS

Hey there, let's work through this Ionic installation issue together—your error log points to two key problems that we can resolve step by step.

Key Issues Identified

  1. Outdated Node.js Version: You're running Node v7.0.0, which is extremely old (released back in 2016). The fsevents package (a dependency of Ionic) doesn't have pre-built binaries for this Node version's ABI (node-v51), forcing a source compile that triggers permission errors.
  2. Sudo Permission Conflicts: Using sudo to install global npm packages often leads to ownership issues in your node_modules directory, causing the EACCES: permission denied error when node-gyp tries to clean/build files.

Step-by-Step Solutions

1. Upgrade Node.js to a Stable LTS Version

Old Node versions are not just incompatible with modern packages—they also lack security updates. We'll use Node Version Manager (nvm) to safely manage and upgrade your Node installation:

  • First, uninstall your current Node.js (if you installed it via Homebrew):
    brew uninstall node
    
  • Install nvm (run the official installation script in your terminal, then restart the terminal to activate it)
  • Install the latest long-term support (LTS) Node version:
    nvm install --lts
    
  • Set this LTS version as your default:
    nvm alias default lts/*
    

2. Fix Global npm Permissions (No More Sudo!)

Running sudo npm install -g is a common pitfall that causes ownership conflicts. Let's configure npm to use a user-specific directory for global packages:

  • Create a dedicated global npm directory:
    mkdir ~/.npm-global
    
  • Tell npm to use this directory:
    npm config set prefix '~/.npm-global'
    
  • Add the directory to your system PATH (update the config file based on your shell—.bash_profile for Bash, .zshrc for Zsh):
    echo 'export PATH=~/.npm-global/bin:$PATH' >> ~/.zshrc
    source ~/.zshrc
    
  • If you already have permission issues in your existing global node_modules folder, fix ownership with:
    sudo chown -R $USER:$GROUP /usr/local/lib/node_modules
    

3. Reinstall Ionic Correctly

Note: The official Ionic package is now @ionic/cli (the old ionic package is deprecated). Install it with:

npm install -g @ionic/cli

Why This Works

  • Upgrading Node.js ensures fsevents can find pre-built binaries for your Node version, eliminating the need for node-gyp to compile from source.
  • Fixing permissions removes the EACCES errors that were blocking the installation process.
  • Using the modern @ionic/cli package ensures you're getting the latest, supported version of Ionic.

内容的提问来源于stack exchange,提问作者Urban Weigl

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.21 03:43:41