Module not found: Error: Cannot resolve 'file' or 'directory' 报错

 

在Centos7下跑VUE项目,编译报错:

注:项目在windows下跑正常的。没有缺包。

[root@takeout takeoutmp]# npm run build

> [email protected] build /takeout/shell/takeoutmp
> node build/build.js

  Tip:
  Built files are meant to be served over an HTTP server.
  Opening index.html over file:// won't work.

⠋ building for production...clean-webpack-plugin: /takeout/shell/takeoutmp/build/build/*.* has been removed.
Hash: c4edcb8bb79b9ed5724d
Version: webpack 1.15.0
Time: 22593ms
                                              Asset       Size  Chunks             Chunk Names
                          static/img/bg.f7a358e.jpg     143 kB          [emitted]  
                      static/img/icon-1.ceed968.png    17.2 kB          [emitted]  
                      static/img/icon-1.f33533a.png    15.7 kB          [emitted]  
                      static/img/icon_1.7b48568.png    41.2 kB          [emitted]  
                       static/img/guoqi.6a4b9b2.png    14.8 kB          [emitted]  
                      static/img/icon_1.77affa6.png    24.7 kB          [emitted]  
         static/js/manifest.c4edcb8bb79b9ed5724d.js  781 bytes       0  [emitted]  manifest
              static/js/app.c4edcb8bb79b9ed5724d.js     362 kB    1, 0  [emitted]  app
           static/js/vendor.c4edcb8bb79b9ed5724d.js     467 kB    2, 0  [emitted]  vendor
static/css/app.346bc3c87c1a8e82504859a5486593d8.css     300 kB    1, 0  [emitted]  app
                                         index.html  614 bytes          [emitted]  

ERROR in ./src/main.js
Module not found: Error: Cannot resolve 'file' or 'directory' /takeout/shell/takeoutmp/src/components/editaddressList/editaddressList in /takeout/shell/takeoutmp/src
 @ ./src/main.js 107:23-76
[root@takeout takeoutmp]# 

解决方法:

后面发现Centos7下对文件名的大小比较严格,/takeout/shell/takeoutmp/src/components/editaddressList/editaddressList  文件名一定要跟main.js里的import editaddressList from 'components/editaddressList/editaddressList';   文件名一致。 windows下就没这么严格。

其它错误可以参考:https://blog.csdn.net/yiifaa/article/details/53691660

 

你可能感兴趣的:(VUE)