Laravel 5.3运行gulp命令的时候,出现以下错误:
D:\wnmp\www\laravel-5-3-demo>gulp
(node:12992) fs: re-evaluating native module sources is not supported. If you are using the graceful-fs module, please update it to a more recent version.
[02:47:21] Using gulpfile D:\wnmp\www\laravel-5-3-demo\gulpfile.js
[02:47:21] Starting 'all'...
[02:47:21] Starting 'sass'...
[02:47:21] Finished 'sass' after 375 ms
[02:47:21] Starting 'webpack'...
{ [Error: ./~/babel-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/components/Example.vue
Module build failed: Error: Cannot remove "babel-plugin-transform-es2015-modules-commonjs" from the plugin list.
at Object.<anonymous> (D:\wnmp\www\laravel-5-3-demo\node_modules\babel-preset-es2015-webpack\index.js:35:11)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
at Module.load (module.js:458:32)
at tryModuleLoad (module.js:417:12)
at Function.Module._load (module.js:409:3)
at Module.require (module.js:468:17)
at require (internal/module.js:20:19)
at D:\wnmp\www\laravel-5-3-demo\node_modules\babel-core\lib\transformation\file\options\option-manager.js:324:15
at Array.map (native)
@ ./resources/assets/js/components/Example.vue 2:17-130
@ ./resources/assets/js/app.js]
message: './~/babel-loader!./~/vue-loader/lib/selector.js?type=script&index=0!./resources/assets/js/components/Example.vue\nModule build failed: Error: Cannot remove "babel-plugin-transform-es2015-modules-commonjs" from the plugin list.\n at Object.<anonymous> (D:\wnmp\www\laravel-5-3-demo\node_modules\babel-preset-es2015-webpack\index.js:35:11)\n at Module._compile (module.js:541:32)\n at Object.Module._extensions..js (module.js:550:10)\n at Module.load (module.js:458:32)\n at tryModuleLoad (module.js:417:12)\n at Function.Module._load (module.js:409:3)\n at Module.require (module.js:468:17)\n at require (internal/module.js:20:19)\n at D:\wnmp\www\laravel-5-3-demo\node_modules\babel-core\lib\transformation\file\options\option-manager.js:324:15\n at Array.map (native)\n @ ./resources/assets/js/components/Example.vue 2:17-130\n @ ./resources/assets/js/app.js',
showStack: false,
showProperties: true,
plugin: 'webpack-stream',
__safety: { toString: [Function: bound ] } }
根据这篇帖子, https://github.com/gajus/babe...
有两种解决办法:
1.
npm i -D -E babel-preset-es2015@6.9.0
2.
// .babelrc
{
"presets": [
["es2015", {"modules": false}]
]
}
我想使用第2种方法,但是有两个问题:
1、.babelrc
文件应该放在什么地方?
2、需要删除什么东西然后重新安装它吗?
帖子上说手动删除node_modules文件夹然后再运行 npm i
直接注释箭头所指的 就可以gulp了