我在Windows上使用Ubuntu。我克隆了一个新的react-redux-starter-kit。 react-redux-universal-hot-example和我自己的实现存在同样的问题。
在npm install
之后,我使用npm start
启动了服务器,页面运行良好。
编辑文件后,我收到以下错误:
Unhandled rejection Error: Module build failed: Error: ENOENT: no such file or directory, open '/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/src/main.js'
at Error (native)
at Compiler.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/build/webpack.config.js:69:15)
at Compiler.applyPlugins (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/tapable/lib/Tapable.js:26:37)
at Watching._done (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compiler.js:78:17)
at Watching.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compiler.js:51:17)
at /mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compiler.js:403:12
at Compiler.next (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/tapable/lib/Tapable.js:67:11)
at Compiler.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/CachePlugin.js:40:4)
at Compiler.applyPluginsAsync (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/tapable/lib/Tapable.js:71:13)
at Compiler.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compiler.js:400:9)
at Compilation.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compilation.js:577:13)
at Compilation.applyPluginsAsync (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compilation.js:572:10)
at Compilation.applyPluginsAsync (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compilation.js:567:9)
at Compilation.applyPluginsAsync (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/tapable/lib/Tapable.js:60:69)
at Compilation.<anonymous> (/mnt/c/Users/xxx/WebstormProjects/react-redux-starter-kit/node_modules/webpack/lib/Compilation.js:563:8)
我编辑的文件是找不到的文件(main.js),但文件存在。我确定还有其他人有同样的问题。有人有修复吗?
我正在使用最新的Windows Insider Build 14965和最新的Ubuntu,但问题也出现在之前的版本中。
答案 0 :(得分:1)
找到了解决方法。你必须添加:
watchOptions: {
aggregateTimeout: 300,
poll: 1000
}
到您的webpack-dev-server,因为当前WSL不支持侦听这些事件。这也适用于Ruby和其他配置,但使用另一个配置。
请参阅here。
我认为微软有一天会解决这个问题。
答案 1 :(得分:0)
对于我使用Ionic 2,导致上述错误是由于导入时出现区分大小写问题。
在我的例子中,我正在做以下事情:
import { MapRangeModel } from '../model/maprangeModel';
什么时候应该是:
import { MapRangeModel } from '../model/mapRangeModel';