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

执行ng new my-app时uws@9.14.0包安装失败求助

Fixing uws@9.14.0 Installation Failure When Creating Angular Projects on AWS EC2 Linux x64

Hey there, let's work through this uws installation error you're facing while running ng new my-app on your AWS EC2 Linux instance. The root issues here usually boil down to missing system-level build dependencies for node-gyp or compatibility mismatches between your older Node.js version (9.9.0) and the uws@9.14.0 package. Here are step-by-step fixes to resolve this:

1. Install Required System Build Dependencies

node-gyp (the tool compiling uws's native code) needs specific tools to run. AWS EC2's default Linux images often don't include these out of the box.

  • For Amazon Linux 2/RHEL/CentOS:
    sudo yum install gcc-c++ make python2 -y
    
  • For Ubuntu/Debian:
    sudo apt-get update && sudo apt-get install build-essential python2 -y
    

Note: uws@9.14.0 relies on Python 2, so make sure you don't use Python 3 here.

2. Clean npm Cache and Reinstall Dependencies

Corrupted cache or partial installs can also trigger this error. Let's reset your project's dependencies:

  1. Clean the npm cache:
    npm cache clean --force
    
  2. Delete the existing node_modules folder and lock file:
    rm -rf node_modules package-lock.json
    
  3. Re-run the install command:
    npm install
    

3. Workaround: Skip Native Module Compilation (Temporary)

If the above steps don't work, you can temporarily bypass the node-gyp rebuild for uws:

npm install --ignore-scripts

Warning: This skips all script runs for packages, so only use this if you're sure other dependencies don't need native compilation.

4. Upgrade Node.js (Long-Term Solution)

Node.js 9.x is no longer supported (reached end-of-life years ago), which is a major source of compatibility issues with older packages like uws@9.14.0. Upgrading to an LTS version (like 14.x, which is still supported) will resolve most such problems:

  1. Install nvm (Node Version Manager) to manage Node versions easily:
    curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.7/install.sh | bash
    
  2. Source your shell profile to activate nvm:
    source ~/.bashrc
    
  3. Install and use Node.js 14 LTS:
    nvm install 14
    nvm use 14
    
  4. Now re-run your Angular project creation command:
    ng new my-app
    

Once you've tried these steps, the uws installation should complete without errors. If you still run into issues, double-check that your EC2 instance has internet access to download all required packages.

内容的提问来源于stack exchange,提问作者MILJO JOHN

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.20 12:20:23