Webpack遍历loader的时候出错

新手上路,请多包涵

报错信息如下:
问题应该是直接把loader的目录加上当年目录,跪了。不知道什么原因。

ERROR in G:/download/avalon.bootstrap-master/avalon.bootstrap-master/css/bootstr
ap.css
Module not found: Error: Cannot resolve 'file' or 'directory' ./C:/Users/Adminis
trator/AppData/Roaming/npm/node_modules/css-loader/index.js in G:\download\avalo
n.bootstrap-master\avalon.bootstrap-master\css
resolve file
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js.webpack-loader.js
doesn't exist
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js doesn't exist
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js.web-loader.js does
n't exist
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js.loader.js doesn't
exist
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js.js doesn't exist
resolve directory
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js doesn't exist (dir
ectory default file)
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\css-loader\index.js\package.json doesn
't exist (directory description file)
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\css-loader\index.js.webpack-loader.js]
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\css-loader\index.js]
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\css-loader\index.js.web-loader.js]
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\css-loader\index.js.loader.js]
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\css-loader\index.js.js]
 @ G:/download/avalon.bootstrap-master/avalon.bootstrap-master/css/bootstrap.css
 4:14-120

ERROR in G:/download/avalon.bootstrap-master/avalon.bootstrap-master/css/bootstr
ap.css
Module not found: Error: Cannot resolve 'file' or 'directory' ./C:/Users/Adminis
trator/AppData/Roaming/npm/node_modules/style-loader/addStyles.js in G:\download
\avalon.bootstrap-master\avalon.bootstrap-master\css
resolve file
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js doesn't exis
t
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js.js doesn't e
xist
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js.css doesn't
exist
resolve directory
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js doesn't exis
t (directory default file)
  G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admin
istrator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js\package.json
 doesn't exist (directory description file)
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js]
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js.js]
[G:\download\avalon.bootstrap-master\avalon.bootstrap-master\css\C:\Users\Admini
strator\AppData\Roaming\npm\node_modules\style-loader\addStyles.js.css]
 @ G:/download/avalon.bootstrap-master/avalon.bootstrap-master/css/bootstrap.css
 7:13-108
阅读 5.3k
1 个回答

需要让 webpack 和你的项目保持在一个盘符下。这是 webpack 在 windows 下的 bug,有提交过 pr,但一直没有处理。

撰写回答
你尚未登录,登录后可以
  • 和开发者交流问题的细节
  • 关注并接收问题和回答的更新提醒
  • 参与内容的编辑和改进,让解决方法与时俱进
推荐问题
宣传栏