7***@qq.com
7***@qq.com
  • 发布:2019-04-15 11:05
  • 更新:2019-05-08 14:06
  • 阅读:1685

【报Bug】uni-app 1.9 打包APP时报如下错误

分类:uni-app
[HBuilder] 11:04:00.326 { Error: ENOENT: no such file or directory, open 'F:\code\hd\src\unpackage\dist\build\.tmp\app-plus\app.json'  
[HBuilder] 11:04:00.326     at Object.fs.openSync (fs.js:646:18)  
[HBuilder] 11:04:00.333     at Object.fs.readFileSync (fs.js:551:33)  
[HBuilder] 11:04:00.334     at parseConfig (D:\HbuildX\HBuilderX\plugins\weapp-tools\lib\index.js:1:4187)  
[HBuilder] 11:04:00.341     at index (D:\HbuildX\HBuilderX\plugins\weapp-tools\lib\index.js:1:13595)  
[HBuilder] 11:04:00.342     at Promise (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\vue-cli-plugin-hbuilderx\packages\webpack-app-plus-plugin\index.js:17:11)  
[HBuilder] 11:04:00.350     at new Promise (<anonymous>)  
[HBuilder] 11:04:00.350     at compiler.hooks.done.tapPromise.compilation (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\@dcloudio\vue-cli-plugin-hbuilderx\packages\webpack-app-plus-plugin\index.js:12:14)  
[HBuilder] 11:04:00.359     at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:17:17)  
[HBuilder] 11:04:00.360     at AsyncSeriesHook.lazyCompileHook (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\tapable\lib\Hook.js:154:20)  
[HBuilder] 11:04:00.369     at onCompiled (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\webpack\lib\Compiler.js:228:21)  
[HBuilder] 11:04:00.370     at hooks.afterCompile.callAsync.err (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\webpack\lib\Compiler.js:556:14)  
[HBuilder] 11:04:00.381     at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:6:1)  
[HBuilder] 11:04:00.381     at AsyncSeriesHook.lazyCompileHook (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\tapable\lib\Hook.js:154:20)  
[HBuilder] 11:04:00.393     at compilation.seal.err (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\webpack\lib\Compiler.js:553:30)  
[HBuilder] 11:04:00.393     at AsyncSeriesHook.eval [as callAsync] (eval at create (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\tapable\lib\HookCodeFactory.js:32:10), <anonymous>:6:1)  
[HBuilder] 11:04:00.403     at AsyncSeriesHook.lazyCompileHook (D:\HbuildX\HBuilderX\plugins\uniapp-cli\node_modules\tapable\lib\Hook.js:154:20)  
[HBuilder] 11:04:00.403   errno: -4058,  
[HBuilder] 11:04:00.414   code: 'ENOENT',  
[HBuilder] 11:04:00.415   syscall: 'open',  
[HBuilder] 11:04:00.428   path: 'F:\\code\\hd\\src\\unpackage\\dist\\build\\.tmp\\app-plus\\app.json' }  
[HBuilder] 11:04:00.428 [ERROR] 读取app.json失败...  
[HBuilder] 11:04:00.440 ENOENT: no such file or directory, copyfile 'F:\code\hd\src\unpackage\dist\build\.tmp\app-plus\manifest.json' -> 'F:\code\hd\src\unpackage\dist\build\app-plus\manifest.json'  
2019-04-15 11:05 负责人:无 分享
已邀请:
Trust

Trust - 少说废话

手动删除 unpackage 目录,然后选择真机运行,确认下开发期间是否会有问题。

  • 7***@qq.com (作者)

    删除后,真机运行可以正常运行,多了我下方回复的一段提示

    2019-04-15 11:25

7***@qq.com

7***@qq.com (作者)

微信端 H5端 正常

7***@qq.com

7***@qq.com (作者)

11:21:09.816  {"__UUID__":"Invocation234774343","__TYPE__":"JSBObject","className":"android.support.v4.app.NotificationManagerCompat"} at App.vue:219  
11:21:09.850  已开启通知权限 at App.vue:221  

多了一个上方的提示,开发期间其他功能正常

  • Trust

    App.vue 里面有这些 log 么,确认一下。另外云端打包还有问题么。

    2019-04-15 11:33

7***@qq.com

7***@qq.com (作者)

找到原因了:是因为之前在组件中有类似如下代码

// #ifndef H5  
A(){  
   // #ifdef APP-PLUS  
    let a=""  
   // #endif  

   // #ifdef MP-WEIXIN  
    let a=""  
   // #endif  
}  
// #endif

1.9 版本APP编译时,开发环境会提示变量重复。 正式包没有提示错误,估计是编译失败然后导致找不到APP.json
疑问:如上这种嵌套的编译语法是否是正确的,之前版本这样写是没问题的

  • Trust

    暂时把外层的那个 ndef H5 去掉看有没有问题,嵌套的事情在确认。

    2019-04-15 11:36

  • 7***@qq.com (作者)

    回复 Trust:嗯,去掉或者重新定义变量都可以正常运行

    2019-04-15 11:38

Trust

Trust - 少说废话

变量重复是 lint 的插件校验的,应当这样写:

// #ifndef H5    
A() {  
    let a = '';  
    // #ifdef APP-PLUS    
    a = ''  
    // #endif    
    // #ifdef MP-WEIXIN    
    a = ''  
    // #endif    
}  
// #endif  
  • 7***@qq.com (作者)

    收到,感谢~~

    2019-04-15 11:40

t_p

t_p

我也遇到这个问题,检查过你们说的情况,排查了还是报错,有大神帮忙解决下吗

该问题目前已经被锁定, 无法添加新回复