'mix' 在 Laravel 8 新安装中不被识别为内部或外部命令

问题描述 投票:0回答:7

我已经安装了一个新的 Laravel 8 应用程序,然后我运行...

npm install

之后,我跑...

npm run dev

我收到以下错误。

'mix' 不被识别为内部或外部命令


> @ dev E:\wamp64\www\Laravel8Projects\Laravel_Livewire_JetStream_Projects\jetstream_blog
> npm run development


> @ development E:\wamp64\www\Laravel8Projects\Laravel_Livewire_JetStream_Projects\jetstream_blog
> mix

'mix' is not recognized as an internal or external command, operable
program or batch file. npm ERR! code ELIFECYCLE npm ERR! errno 1 npm
ERR! @ development: `mix` npm ERR! Exit status 1 npm ERR! npm ERR!
Failed at the @ development script. npm ERR! This is probably not a
problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!    
C:\Users\HP\AppData\Roaming\npm-cache\_logs\2021-01-18T17_03_24_944Z-debug.log
npm ERR! code ELIFECYCLE npm ERR! errno 1 npm ERR! @ dev: `npm run
development` npm ERR! Exit status 1 npm ERR! npm ERR! Failed at the @
dev script. npm ERR! This is probably not a problem with npm. There is
likely additional logging output above.

npm ERR! A complete log of this run can be found in: npm ERR!    
C:\Users\HP\AppData\Roaming\npm-cache\_logs\2021-01-18T17_03_24_980Z-debug.log
php laravel npm laravel-8 laravel-mix
7个回答
133
投票

您可能需要安装最新版本的 Laravel Mix。

npm install laravel-mix@latest --save-dev

27
投票

当你的缓存有以前的文件时会发生这种情况。清除缓存并重新安装 npm

npm cache clean --force

然后:

npm install

npm fix audit

然后:

npm run development

2
投票

按照以下步骤解决了我的问题

 npm install --g laravel-mix

npm install --g webpack-cli

0
投票

首先删除 node_modules 目录并运行以下命令 one be one

npm cache clean --force

npm install

npm install --g laravel-mix

npm install --g webpack-cli

npm run development

-1
投票

NPM 安装 它会修复它 它发生了,因为你在之前的 NMP I 之后安装了一些东西

所以,在任何奇怪的情况下 - NPM INSTALL again)


-4
投票

package.json 要求您运行 mix-watch 命令,但它不起作用

一个对我有用的简单修复是运行 npm run watch 它对我有用 laravel 8 项目


-5
投票

如果你是 Windows 用户试试这个:

C:\Users{{your-username}}\AppData\Roaming\npm-cache

然后:

npm cache verify
© www.soinside.com 2019 - 2024. All rights reserved.