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

Laravel 5.6+Bootstrap项目执行npm run dev报错求助

Fixing "cross-env: not found" Error in Laravel 5.6 + Bootstrap Project

Hey there, that cross-env: not found error is a super common hiccup when working with Laravel Mix. Let's break down how to fix it quickly:

Why this happens

When you run npm run dev, Laravel Mix relies on the cross-env package to set your NODE_ENV environment variable. The error means this package either wasn't installed at all, or the installation got corrupted along the way.

Step-by-step fixes

  • First, do a clean reinstall of dependencies
    Sometimes the node_modules folder or lock files get messed up. Run these commands in your project root:

    rm -rf node_modules package-lock.json
    npm install
    

    If you use Yarn instead, swap out the last command with yarn install.

  • If clean install doesn't work, manually install cross-env
    Force-install the package as a development dependency:

    npm install cross-env --save-dev
    

    For Yarn users, use this instead: yarn add cross-env --dev

  • Try running the dev command again
    Once the installation finishes, fire up the dev script again:

    npm run dev
    

Quick note for Linux/macOS users

If you hit permission errors during installation, you can try running the commands with sudo (e.g., sudo npm install), but it's better to fix your npm permissions long-term to avoid relying on sudo for package installs.

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.26 08:18:07