Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

更新 68 版本后,h5 编译出错 #289

Closed
Dithub2016 opened this issue Jul 9, 2018 · 6 comments
Closed

更新 68 版本后,h5 编译出错 #289

Dithub2016 opened this issue Jul 9, 2018 · 6 comments

Comments

@Dithub2016
Copy link

Dithub2016 commented Jul 9, 2018

问题描述
项目是在 版本 60 的时候用 taro init 创建的 js 项目,68版本之前 npm run dev:h5 编译没报错,但也没正常运作,build:h5 完全正常,小程序的编译正常。
更新到 68 后,dev:h5build:h5 都出错了,每个 js 文件都报了同一个错误最后还输出了个 module not found

复现步骤

期望行为
未知

报错信息
以下为 运行 build:h5 的结果

创建  发现文件  src\pages\tools\expressDetails\index.js
TypeError: Cannot read property '0' of undefined
    at new Parser (C:\git\weapp\node_modules\babylon\lib\index.js:1577:45)
    at Object.parse (C:\git\weapp\node_modules\babylon\lib\index.js:7305:10)
    at getAst (C:\git\weapp\node_modules\babel-template\lib\index.js:29:21)
    at C:\git\weapp\node_modules\babel-template\lib\index.js:53:24
    at exit (C:\git\weapp\node_modules\@tarojs\cli\src\h5.js:330:63)
    at NodePath._call (C:\git\weapp\node_modules\babel-traverse\lib\path\context.js:76:18)
    at NodePath.call (C:\git\weapp\node_modules\babel-traverse\lib\path\context.js:48:17)
    at NodePath.visit (C:\git\weapp\node_modules\babel-traverse\lib\path\context.js:117:8)
    at TraversalContext.visitQueue (C:\git\weapp\node_modules\babel-traverse\lib\context.js:150:16)
    at TraversalContext.visitSingle (C:\git\weapp\node_modules\babel-traverse\lib\context.js:108:19)from
    at exports.default (C:\git\weapp\node_modules\babel-template\lib\index.js:12:11)
    at exit (C:\git\weapp\node_modules\@tarojs\cli\src\h5.js:330:24)
    at NodePath._call (C:\git\weapp\node_modules\babel-traverse\lib\path\context.js:76:18)
    at NodePath.call (C:\git\weapp\node_modules\babel-traverse\lib\path\context.js:48:17)
    at NodePath.visit (C:\git\weapp\node_modules\babel-traverse\lib\path\context.js:117:8)
    at TraversalContext.visitQueue (C:\git\weapp\node_modules\babel-traverse\lib\context.js:150:16)
    at TraversalContext.visitSingle (C:\git\weapp\node_modules\babel-traverse\lib\context.js:108:19)
    at TraversalContext.visit (C:\git\weapp\node_modules\babel-traverse\lib\context.js:192:19)
    at Function.traverse.node (C:\git\weapp\node_modules\babel-traverse\lib\index.js:114:17)
    at traverse (C:\git\weapp\node_modules\babel-traverse\lib\index.js:79:12)
./.temp/app.js
Module not found: Can't resolve './pages/login/index' in 'C:\git\weapp\.temp'

系统信息

  • 操作系统: Windows 7
  • Taro 版本 v0.0.68
  • Node.js 版本 v8.11.2
@luckyadam
Copy link
Member

@Littly

@Lin-YingYu
Copy link

同上~
Taro v0.0.68
TypeError: Cannot read property '0' of undefined
var getPage = function getPage(pathname) {
if (pathname in registeredPages) {
return registeredPages[pathname];
} else {
return registeredPagesArr[0][1];
}
};
// 应该注册页面这~。。。

@nooldey
Copy link

nooldey commented Jul 17, 2018

同上~
Taro v0.0.70

TypeError: Cannot read property '0' of undefined
...
创建  发现文件  src\pages\index\index.scss

�   Compile failed!

./.temp/app.js
Module not found: Can't resolve './pages/index/index' in 'D:\nooldey\GIT\boilerplates\miniapp\MTools\.temp'

**但是!**以上报错是出现在项目用npx @tarojs/cli init MTools后,运行npx taro build --type h5 --watch,进行编译开发时报的错。

报错信息关键字:babylon babel-template @tarojs/cli

而采用全局安装@tarojs/cli后,用常规的指令初始化一个项目,配置完全相同的,运行完全正常。

@yuche
Copy link
Contributor

yuche commented Jul 17, 2018

#332
给出的解决方案是否可行?

@nooldey
Copy link

nooldey commented Jul 17, 2018

@yuche
重命名src/pages/index/src/pages/home/

重命名src/pages/index/index.jssrc/pages/index/main.js
并修改app.js中的引用路径。

目前暂未解决该问题。

不太理解#332中所说的缩短名称具体是指什么,是缩短js文件名还是缩短引用的路径长度?

@yuche
Copy link
Contributor

yuche commented Jul 20, 2018

c2e2184
修复了这个问题。下一个版本 0.0.71 就可以了。

@yuche yuche closed this as completed Jul 20, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

5 participants