详细问题描述
使用vue-cli创建hello-uniapp 进入目录执行npm run build:h5,出现报错内容
创建的看图模板h5编译通过无异常!!
[内容]
Module build failed (from ./node_modules/postcss-loader/src/index.js):
TypeError: decl.moveTo is not a function
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\my-project\src\hhh\pub\
f\App.vue:544:2
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\my-project\src\hhh\pub\
f\App.vue:545:2
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules\postcss-me
rge-rules\dist\index.js:246:22
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules\postcss-lo
ader\node_modules\postcss\lib\container.js:135:18
at Rule.each (C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules
\postcss-loader\node_modules\postcss\lib\container.js:101:16)
at Rule.walk (C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules
\postcss-loader\node_modules\postcss\lib\container.js:131:17)
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules\postcss-me
rge-rules\dist\index.js:242:18
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules\postcss-lo
ader\node_modules\postcss\lib\container.js:239:18
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules\postcss-lo
ader\node_modules\postcss\lib\container.js:135:18
at Root.each (C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules
\postcss-loader\node_modules\postcss\lib\container.js:101:16)
at Root.walk (C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules
\postcss-loader\node_modules\postcss\lib\container.js:131:17)
at Root.walkRules (C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_mo
dules\postcss-loader\node_modules\postcss\lib\container.js:237:19)
at C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_modules\postcss-me
rge-rules\dist\index.js:267:13
at LazyResult.run (C:\Users\Administrator\Desktop\font-awesome-4.7.0\node_mo
dules\postcss-loader\node_modules\postcss\lib\lazy-result.js:295:14)
at LazyResult.asyncTick (C:\Users\Administrator\Desktop\font-awesome-4.7.0\n
ode_modules\postcss-loader\node_modules\postcss\lib\lazy-result.js:208:26)
at LazyResult.asyncTick (C:\Users\Administrator\Desktop\font-awesome-4.7.0\n
ode_modules\postcss-loader\node_modules\postcss\lib\lazy-result.js:221:14)
at LazyResult.asyncTick (C:\Users\Administrator\Desktop\font-awesome-4.7.0\n
ode_modules\postcss-loader\node_modules\postcss\lib\lazy-result.js:221:14)
at LazyResult.asyncTick (C:\Users\Administrator\Desktop\font-awesome-4.7.0\n
ode_modules\postcss-loader\node_modules\postcss\lib\lazy-result.js:221:14)
@ ./node_modules/@dcloudio/vue-cli-plugin-uni/packages/h5-vue-style-loader??ref
--6-oneOf-1-0!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-prepr
ocess-loader??ref--6-oneOf-1-1!./node_modules/css-loader??ref--6-oneOf-1-2!./nod
e_modules/vue-loader/lib/loaders/stylePostLoader.js!./node_modules/postcss-loade
r/src??ref--6-oneOf-1-3!./node_modules/postcss-loader/src??ref--6-oneOf-1-4!./no
de_modules/cache-loader/dist/cjs.js??ref--0-0!./node_modules/vue-loader/lib??vue
-loader-options!./node_modules/@dcloudio/vue-cli-plugin-uni/packages/webpack-sco
ped-loader!./node_modules/wrap-loader??ref--17!./my-project/src/hhh/pub/f/App.vu
e?vue&type=style&index=0&lang=css& 4:14-762
@ ./my-project/src/hhh/pub/f/App.vue?vue&type=style&index=0&lang=css&
@ ./my-project/src/hhh/pub/f/App.vue
@ ./my-project/src/hhh/pub/f/main.js
@ multi ./my-project/src/hhh/pub/f/main.js
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! my-project@0.1.0 build:h5: cross-env NODE_ENV=production UNI_PLATFORM= h5 vue-cli-service uni-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the my-project@0.1.0 build:h5 script.
npm ERR! This is probably not a problem with npm. There is likely additional log
ging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Administrator\AppData\Roaming\npm-cache_logs\2019-04-23T1
5_31_06_023Z-debug.log
[windows版本号]
windows10 ,windows7
[QQ]1957444872
4 个回复
m***@95jw.cn
顶,,TypeError: decl.moveTo is not a function 也是这个错误,且无法成功npm update.
zhangsanmu
追问,问题解决了吗,啥原因啊
1***@qq.com
我刚好发现问题,好像是官方的uni.css文件问题,你不引用它,就可以编译成功。但是我还没有发现这个css文件哪里有问题,继续找bug
2019-05-15 17:16
1***@qq.com
不晓得,我们问题是不是一样的,我是引人了uni.css就build不成功,不引入就好了
2019-05-15 17:17
1***@qq.com
经过查找:.uni-list-cell-navigate {
font-size:30upx;
padding: 22upx 30upx;
line-height: 48upx;
position: relative;
display: flex;
box-sizing: border-box;
width: 100%;
flex: 1;
justify-content: space-between;
align-items: center;
}
.uni-list-cell-navigate {
}
是由于这个css引起;
解决办法是把它们合并在一起:
.uni-list-cell-navigate {
font-size:30upx;
padding: 22upx 30upx;
line-height: 48upx;
position: relative;
display: flex;
box-sizing: border-box;
width: 100%;
flex: 1;
justify-content: space-between;
align-items: center;
padding-right: 36upx;
}
解决
2019-05-15 17:40
zhangsanmu
回复 1***@qq.com: 我之前还是没问题的,因为项目已经上线了,一般不会去编译,最后一次编译是上周日,平常dev:h5的时候是没问题的,今儿项目又改动,重新编译,报的这个错误:
"D:\WebStorm 2018.2.5\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" run build:h5 --scripts-prepend-node-path=auto
开始编译当前项目至 h5 平台...
ERROR Failed to compile with 16 errors17:11:50
error in ./src/pages/user/lightStones.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
compiler.parseComponent is not a function
@ ./src/pages/user/lightStones.vue?vue&type=script&lang=js& 1:0-857 1:873-876 1:878-1732 1:878-1732
@ ./src/pages/user/lightStones.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/wonders/musang.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
compiler.parseComponent is not a function
@ ./src/pages/wonders/musang.vue?vue&type=script&lang=js& 1:0-852 1:868-871 1:873-1722 1:873-1722
@ ./src/pages/wonders/musang.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/App.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
compiler.parseComponent is not a function
at PoolWorker.fromErrorObj (C:\AppServ\www\gitlab\wonders_code\node_modules_thread-loader@2.1.2@thread-loader\dist\WorkerPool.js:258:12)
at C:\AppServ\www\gitlab\wonders_code\node_modules_thread-loader@2.1.2@thread-loader\dist\WorkerPool.js:200:29
at mapSeries (C:\AppServ\www\gitlab\wonders_code\node_modules_neo-async@2.6.1@neo-async\async.js:3625:14)
at PoolWorker.onWorkerMessage (C:\AppServ\www\gitlab\wonders_code\node_modules_thread-loader@2.1.2@thread-loader\dist\WorkerPool.js:166:35)
at readBuffer (C:\AppServ\www\gitlab\wonders_code\node_modules_thread-loader@2.1.2@thread-loader\dist\WorkerPool.js:148:14)
at Socket.onChunk (C:\AppServ\www\gitlab\wonders_code\node_modules_thread-loader@2.1.2@thread-loader\dist\readBuffer.js:36:9)
at Socket.emit (events.js:189:13)
at parse (C:\AppServ\www\gitlab\wonders_code\nodemodules\@vue_component-compiler-utils@2.6.0@@vue\component-compiler-utils\dist\parse.js:14:23)
at Object.module.exports (C:\AppServ\www\gitlab\wonders_code\node_modules_vue-loader@15.7.0@vue-loader\lib\index.js:67:22)
@ ./src/App.vue?vue&type=script&lang=js& 1:0-866 1:882-885 1:887-1750 1:887-1750
@ ./src/App.vue
@ ./src/main.js
@ multi ./src/main.js
error in ./src/components/control.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 1)
compiler.parseComponent is not a function
@ ./src/components/control.vue?vue&type=script&lang=js& 1:0-829 1:845-848 1:850-1676 1:850-1676
@ ./src/components/control.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/strategy/views.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 1)
compiler.parseComponent is not a function
@ ./src/pages/strategy/views.vue?vue&type=script&lang=js& 1:0-851 1:867-870 1:872-1720 1:872-1720
@ ./src/pages/strategy/views.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/user/author.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 1)
compiler.parseComponent is not a function
@ ./src/pages/user/author.vue?vue&type=script&lang=js& 1:0-852 1:868-871 1:873-1722 1:873-1722
@ ./src/pages/user/author.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/doc.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 2)
compiler.parseComponent is not a function
@ ./src/pages/doc.vue?vue&type=script&lang=js& 1:0-825 1:841-844 1:846-1668 1:846-1668
@ ./src/pages/doc.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/strategy/strategy.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 2)
compiler.parseComponent is not a function
@ ./src/pages/strategy/strategy.vue?vue&type=script&lang=js& 1:0-854 1:870-873 1:875-1726 1:875-1726
@ ./src/pages/strategy/strategy.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/user/user.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 3)
compiler.parseComponent is not a function
@ ./src/pages/user/user.vue?vue&type=script&lang=js& 1:0-850 1:866-869 1:871-1718 1:871-1718
@ ./src/pages/user/user.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/wonders/index.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 3)
compiler.parseComponent is not a function
@ ./src/pages/wonders/index.vue?vue&type=script&lang=js& 1:0-851 1:867-870 1:872-1720 1:872-1720
@ ./src/pages/wonders/index.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/login/login.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 4)
compiler.parseComponent is not a function
@ ./src/pages/login/login.vue?vue&type=script&lang=js& 1:0-851 1:867-870 1:872-1720 1:872-1720
@ ./src/pages/login/login.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/user/playLogs.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 4)
compiler.parseComponent is not a function
@ ./src/pages/user/playLogs.vue?vue&type=script&lang=js& 1:0-854 1:870-873 1:875-1726 1:875-1726
@ ./src/pages/user/playLogs.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/user/userCardBind.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 5)
compiler.parseComponent is not a function
@ ./src/pages/user/userCardBind.vue?vue&type=script&lang=js& 1:0-858 1:874-877 1:879-1734 1:879-1734
@ ./src/pages/user/userCardBind.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/wonders/wish.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 5)
compiler.parseComponent is not a function
@ ./src/pages/wonders/wish.vue?vue&type=script&lang=js& 1:0-850 1:866-869 1:871-1718 1:871-1718
@ ./src/pages/wonders/wish.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/user/userVows.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 6)
compiler.parseComponent is not a function
@ ./src/pages/user/userVows.vue?vue&type=script&lang=js& 1:0-854 1:870-873 1:875-1726 1:875-1726
@ ./src/pages/user/userVows.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/pages/wonders/screen.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 6)
compiler.parseComponent is not a function
@ ./src/pages/wonders/screen.vue?vue&type=script&lang=js& 1:0-852 1:868-871 1:873-1722 1:873-1722
@ ./src/pages/wonders/screen.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wonders@0.2.0 build:h5:
cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wonders@0.2.0 build:h5 script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user5\AppData\Roaming\npm-cache_logs\2019-05-15T09_11_50_220Z-debug.log
进程完成,退出码 1
2019-05-15 17:55
zhangsanmu
把我的每个创建的vue文件都报了一遍错误
2019-05-15 17:55
1***@qq.com
回复 zhangsanmu: 是否 升级没有?npn update ;升级了看下,vue引入组件方式:如果是 .../../components/建议改成@/components方式引入;包删了从新拉下
2019-05-15 18:01
1***@qq.com
回复 zhangsanmu: npm update
2019-05-15 18:03
zhangsanmu
回复 1***@qq.com: 我先试一下
2019-05-15 18:05
zhangsanmu
回复 1***@qq.com: 哇!!!可以了,我弄了很长时间哇!!!我还特地重新安装过node,所以我没考虑过这方面的问题,谢谢大牛
2019-05-15 18:16
豆豆啊 (作者)
回复 zhangsanmu: 其实是合并css出现了问题, 编译的包有bug, 自己合并css就好了,不过还有css丢失的问题,好多,我都好久没用过了,等一段时间看看
2019-05-15 18:20
豆豆啊 (作者)
回复 zhangsanmu: 例如多行文本那个样式,z-index,border:1px solid #xxx border的宽度都会被删了
2019-05-15 18:22
zhangsanmu
回复 豆豆啊: 但是之前是没有这个问题的啊
2019-05-15 19:38
zhangsanmu
回复 1***@qq.com: 又不行了...只要一修改文件,就开始报错,修改那个报哪个,我修改了login.vue和control.vue,然后就报这个错误了:
cnpm run build
开始编译当前项目至 h5 平台...
ERROR Failed to compile with 2 errors19:47:34
error in ./src/pages/login/login.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 0)
compiler.parseComponent is not a function
@ ./src/pages/login/login.vue?vue&type=script&lang=js& 1:0-851 1:867-870 1:872-1720 1:872-1720
@ ./src/pages/login/login.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
error in ./src/components/control.vue?vue&type=script&lang=js&
Module build failed (from ./node_modules/_thread-loader@2.1.2@thread-loader/dist/cjs.js):
Thread Loader (Worker 1)
compiler.parseComponent is not a function
@ ./src/components/control.vue?vue&type=script&lang=js& 1:0-829 1:845-848 1:850-1676 1:850-1676
@ ./src/components/control.vue
@ ./src/pages.json
@ ./src/main.js
@ multi ./src/main.js
ERROR Build failed with errors.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wonders@0.2.0 build:h5:
cross-env NODE_ENV=production UNI_PLATFORM=h5 vue-cli-service uni-build
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wonders@0.2.0 build:h5 script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user5\AppData\Roaming\npm-cache_logs\2019-05-15T11_47_35_046Z-debug.log
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! wonders@0.2.0 build:
npm run build:h5
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the wonders@0.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\user5\AppData\Roaming\npm-cache_logs\2019-05-15T11_47_35_093Z-debug.log
2019-05-15 19:51
zhangsanmu
撤销也不行,撤销之后还是报这个错误
2019-05-15 19:52
1***@qq.com
回复 zhangsanmu: 把包删了,在重新拉,就可以了!
2019-05-16 09:47
zhangsanmu
回复 1***@qq.com: 。。。。。。我试了很多次了,都不行。。。。我再检查一下我的配置吧
2019-05-16 11:02
跨平台uapp - 了解uapp `npm info uapp`
安装最新的这两个包,否则里面调用的是旧版本的 postcss-loader
npm install postcss-merge-rules cssnano
zhengyu
我是本地打包没有出现问题,但是线上服务器打包出现问题,打包不了