Laravel 报错The Mix manifest does not exist,解决办法!

2022-11-09 0 34

Laravel 报错The Mix manifest does not exist,解决办法!

 

环境配置完成之后,运行Laravel,报错信息如下:

The Mix manifest does not exist.

查看package.json文件,发现cross-env缺少了一些环境的支持

Laravel 报错The Mix manifest does not exist,解决办法!

到Node.js官方下载Windows LTS版本,并进行安装

 

{

“private”: true,

“scripts”: {

“dev”: “npm run development”,

“development”: “cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js –progress –hide-modules –config=node_modules/laravel-mix/setup/webpack.config.js”,

“watch”: “npm run development — –watch”,

“watch-poll”: “npm run watch — –watch-poll”,

“hot”: “cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js –inline –hot –config=node_modules/laravel-mix/setup/webpack.config.js”,

“prod”: “npm run production”,

“production”: “cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js –no-progress –hide-modules –config=node_modules/laravel-mix/setup/webpack.config.js”

},

“devDependencies”: {

“axios”: “^0.18”,

“bootstrap”: “^4.0.0”,

“cross-env”: “^5.2.0”,

“jquery”: “^3.2”,

“laravel-mix”: “^2.0”,

“lodash”: “^4.17.5”,

“popper.js”: “^1.12”,

“vue”: “^2.5.17”,

“vue-template-compiler”: “^2.6.10”,

“webpack-laravel-mix-manifest”: “^2.0.1”

},

“dependencies”: {

“@fortawesome/fontawesome-free”: “^5.6.3”,

“china-area-data”: “^4.0.0”,

“sweetalert”: “^2.1.2”

}

}

 

检查安装的版本信息:

 

$ node -v

v10.16.2

 

$ npm -v

6.9.0

 

然后就只需要安装 Laravel Mix。在新的 Laravel 项目中,你可以在目录结构的根目录中找到一个 package.json文件,它包括了运行基本的 Mix 所需的内容。就如同 composer.json 文件,只不过它定义的是 Node 的依赖而不是 PHP。你可以使用以下的命令安装它引用的依赖项:

 

npm install

 

如果你正在 Windows 系统上进行开发,或者在 Windows 主机系统上运行虚拟机,那你要在运行 npm install命令时使用 –no-bin-links:

 

$ npm install –no-bin-links

 

npm WARN ajv-keywords@3.4.1 requires a peer of ajv@^6.9.1 but none is installed. You must install peer dependencies yourself.

npm WARN img-loader@3.0.1 requires a peer of imagemin@^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN webpack-laravel-mix-manifest@2.0.1 requires a peer of webpack@>=4.0.0 but none is installed. You must install peer dependencies yourself.

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):

npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {“os”:”darwin”,”arch”:”any”} (current: {“os”:”win32″,”arch”:”x64″})

 

audited 12750 packages in 23.651s

found 8 vulnerabilities (4 moderate, 4 high)

run `npm audit fix` to fix them, or `npm audit` for details

 

运行 Mix

 

Mix 是位于 Webpack 顶部的配置层,所以要运行 Mix 任务,只需要执行默认的Laravel package.json 文件中包含的一个 NPM 脚本:

 

$ npm run dev

 

> @ dev D:\phpStudy\laravel-shop

> npm run development

 

 

> @ development D:\phpStudy\laravel-shop

> cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js –progress –hide-modules –config=node_modules/laravel-mix/setup/webpack.config.js

 

11% building modules 9/14 modules 5 active …es\js\components\ExampleComponent.vue{ parser: “babylon” } is deprecated; we now treat it as { parser: “babel” }.

95% emitting DONE Compiled successfully in 7495ms9:55:10 PM

 

监控资源文件修改

 

npm run watch 会在你的终端里持续运行,监控所有相关的资源文件以便进行更改。

Webpack 会在检测到文件更改时自动重新编译资源:

 

$ npm run watch

 

在某些环境中,当文件更改时,Webpack 不会更新。如果系统出现这种情况,请考虑使用watch-poll 命令在后台运行:

 

$ npm run watch-poll &

 

 

 

1. 本站所有资源来源于用户上传和网络,因此不包含技术服务请大家谅解!如有侵权请邮件联系客服!cheeksyu@vip.qq.com
2. 本站不保证所提供下载的资源的准确性、安全性和完整性,资源仅供下载学习之用!如有链接无法下载、失效或广告,请联系客服处理!
3. 您必须在下载后的24个小时之内,从您的电脑中彻底删除上述内容资源!如用于商业或者非法用途,与本站无关,一切后果请用户自负!
4. 如果您也有好的资源或教程,您可以投稿发布,成功分享后有积分奖励和额外收入!
5.严禁将资源用于任何违法犯罪行为,不得违反国家法律,否则责任自负,一切法律责任与本站无关

发表评论
暂无评论