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

执行foundation new命令失败,提示npm Node modules未安装

Fixing Node Modules Installation Failure with Foundation CLI

Hey there, no need to apologize—newbies hit these bumps all the time, let’s get this sorted out for you.

1. Clear NPM Cache & Try Manual Installation First

NPM 6.0.0 can sometimes have cache glitches that mess up installations. Let’s start with the quick fix:

  • Run this command to clear the cache: npm cache clean --force
  • Navigate into your newly created project folder (the one you named during foundation new), then run: npm install

In most cases, this will resolve the missing modules issue right away. If not, move on to the next steps.

2. Check Node.js Version Compatibility

Foundation CLI 2.2.5 has specific version sweet spots, and Node.js 10.0.0 (while technically supported) might have minor compatibility quirks. Try downgrading to a more stable, widely tested version using nvm (Node Version Manager):

  • Install nvm if you don’t have it already
  • Run nvm install 8.17.0 (a solid LTS version that works great with this CLI)
  • Switch to this version: nvm use 8.17.0
  • Reinstall Foundation CLI globally: npm install -g foundation-cli
  • Try creating a new project again with foundation new

3. Bypass the CLI & Set Up the Project Manually

If the CLI keeps failing, we can build the project from scratch without it:

  • Create a project folder, cd into it, and initialize npm: npm init -y
  • Install Foundation Sites core: npm install foundation-sites --save
  • If you want the build tools (like Gulp, which the CLI includes by default), install them manually: npm install gulp gulp-sass gulp-autoprefixer --save-dev
  • You can then replicate the basic Foundation template folder structure (src/css, src/js, etc.) and set up your gulpfile.js with standard Foundation build tasks.

4. Rule Out Network Connection Issues

Sometimes slow or blocked connections can prevent NPM from downloading packages. Try switching to a domestic mirror to improve download reliability:

  • For a one-time install: npm install --registry=https://registry.npmmirror.com
  • To set it globally for all future installs: npm config set registry https://registry.npmmirror.com
    Then retry the installation.

Start with step 1 first—it’s the fastest fix. If it still fails, share the exact error message you get when running npm install manually, and I’ll help dig deeper.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 10:55:48