在 Laravel 8 新安装中,“mix”未被识别为内部或外部命令

2022-08-30 10:04:05

我已经安装了一个新的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

答案 1

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

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

答案 2

当您的缓存保存以前的文件时,就会发生这种情况。清除缓存并再次安装 npm

npm cache clean --force

然后:

npm install

npm fix audit

然后:

npm run development

推荐