本文介绍了找不到模块:错误:无法解析“fs"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我从事 Laravel 5.3 项目.在 CMD 中运行 gulp 命令时出现以下错误.

I working on a Laravel 5.3 project. I am getting below errors when I am running gulp command in CMD.

谁能说我怎样才能得到一个错误更少的结果?

Could anyone say how can I get a error less result ?

gulpfile.js

var elixir = require('laravel-elixir');

require('laravel-elixir-vue');

elixir(function(mix) {
    mix.sass('app.scss');
});


elixir(function(mix) {
   mix.webpack('app.js');
});


elixir(function(mix) {
    mix.version(['css/app.css', 'js/app.js']);
});

package.json

{
  "private": true,
  "scripts": {
    "prod": "gulp --production",
    "dev": "gulp watch"
  },
  "devDependencies": {
    "babel-core": "^6.18.2",
    "babel-loader": "^6.2.7",
    "babel-plugin-add-module-exports": "^0.2.1",
    "bootstrap": "^4.0.0-alpha.3",
    "bootstrap-sass": "^3.3.7",
    "buble": "^0.14.2",
    "gulp": "^3.9.1",
    "jquery": "^3.1.0",
    "laravel-elixir": "^6.0.0-9",
    "laravel-elixir-browserify-official": "^0.1.3",
    "laravel-elixir-vue": "^0.1.4",
    "laravel-elixir-vue-2": "^0.2.0",
    "laravel-elixir-webpack-official": "^1.0.2",
    "lodash": "^4.14.0",
    "vue": "^1.0.26",
    "vue-resource": "^0.9.3"
  },
  "dependencies": {
    "admin-lte": "^2.3.7",
    "node-sass": "^3.13.0"
  }
}

推荐答案

如果您使用的是 Laravel 5.5 或更高版本,只需添加:

If your using Laravel 5.5 or above, simply add:

mix.webpackConfig({ node: { fs: 'empty' }})

到你的 webpack.mix.js 文件.

这篇关于找不到模块:错误:无法解析“fs"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-17 17:18