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

运行提示...扩展操作符错误 #125

Open
wind4gis opened this issue Apr 21, 2018 · 11 comments
Open

运行提示...扩展操作符错误 #125

wind4gis opened this issue Apr 21, 2018 · 11 comments

Comments

@wind4gis
Copy link

wind4gis commented Apr 21, 2018

  • wept --version: 最新
  • node --version: 8
  • 操作系统: win7
  • 浏览器及浏览器版本:谷歌浏览器
  • 与官方工具表现不一致?

错误日志

listening on port 3000
request/index.js: Unexpected token (128:18)
SyntaxError: request/index.js: Unexpected token (128:18)
126 | })
127 | let optionHeader = options.header || {}

128 | let headers = { ...getHeaders(), ...optionHeader }
| ^
129 | let method = options.method||"get"
130 | return new Promise((resolve, reject) => {
131 | wx.request({
at Parser.pp$5.raise (C:\Users\Administrator\AppData\Roaming\nvm\v8.0.0\node
_modules\wept\node_modules\babylon\lib\index.js:4454:13)
at Parser.pp.unexpected (C:\Users\Administrator\AppData\Roaming\nvm\v8.0.0\n
ode_modules\wept\node_modules\babylon\lib\index.js:1761:8)
at Parser.pp$3.parseIdentifier (C:\Users\Administrator\AppData\Roaming\nvm\v
8.0.0\node_modules\wept\node_modules\babylon\lib\index.js:4332:10)
at Parser.pp$3.parsePropertyName (C:\Users\Administrator\AppData\Roaming\nvm
\v8.0.0\node_modules\wept\node_modules\babylon\lib\index.js:4156:96)
at Parser.pp$3.parseObj (C:\Users\Administrator\AppData\Roaming\nvm\v8.0.0\n
ode_modules\wept\node_modules\babylon\lib\index.js:4045:12)
at Parser.pp$3.parseExprAtom (C:\Users\Administrator\AppData\Roaming\nvm\v8.
0.0\node_modules\wept\node_modules\babylon\lib\index.js:3719:19)

界面截图(可选)

@wind4gis
Copy link
Author

重新安装了一遍,提示找不到 './build/server' 文件夹,应该是微信IDE版本变了,现在编译出来已经没有这个文件夹了~

@chemzqm
Copy link
Collaborator

chemzqm commented Apr 21, 2018

已知问题,官方的 babel 升级了,但是 wept 没有

@wind4gis
Copy link
Author

额,升级了Babel,现在报的是error C:\Users\Administrator\AppData\Roaming\nvm\v8.0.0\node_modules\wept\node_modules\fsevents\node_modules\tar-pack is not a child of d:\Program Files\nodejs的错误,不知道什么情况

@wind4gis
Copy link
Author

额,报error是因为源的问题,把淘宝源切换回官方源就好了。。。

@wind4gis
Copy link
Author

试过把babel版本升级到最新还是不行
*package.json
{
"name": "wept",
"version": "0.9.6",
"description": "Wechat app page development tool",
"main": "build/server.js",
"bin": "./bin/wept",
"directories": {
"example": "example",
"test": "test"
},
"scripts": {},
"author": "[email protected]",
"license": "MIT",
"dependencies": {
"babel-core": "^6.26.0",
"babel-loader": "^7.1.4",
"babel-plugin-add-module-exports": "^0.2.1",
"babel-plugin-syntax-jsx": "^6.18.0",
"babel-plugin-transform-runtime": "^6.23.0",
"babel-preset-es2015": "^6.24.1",
"babel-preset-react": "^6.24.1",
"babel-preset-stage-0": "^6.24.1",
"babel-runtime": "^6.26.0",
"boxen": "^1.0.0",
"chalk": "^1.1.3",
"chokidar": "^1.6.1",
"commander": "^2.9.0",
"concat-with-sourcemaps": "^1.0.4",
"convert-source-map": "^1.3.0",
"debounce": "^1.0.0",
"et-improve": "^0.1.3",
"faye-websocket": "^0.11.1",
"glob": "^7.1.1",
"growl": "^1.9.2",
"gulp-babel": "^7.0.1",
"jsondiffpatch": "^0.2.4",
"koa": "^1.2.4",
"koa-compress": "^1.0.9",
"koa-formidable": "^1.0.0",
"koa-logger": "^1.3.1",
"koa-router": "^5.4.0",
"koa-send": "^3.3.0",
"koa-static": "^2.0.0",
"merge": "^1.2.0",
"mkdir-p": "0.0.7",
"node-parallel": "^0.1.6",
"node-serial": "^0.1.1",
"object-assign": "^4.1.1",
"open": "0.0.5",
"source-map": "^0.5.6",
"throttleit": "^1.0.0",
"tunnel": "0.0.4",
"update-notifier": "^1.0.3"
},
"devDependencies": {
"stack-source-map": "^1.0.6",
"request-component": "0.0.4",
"autoscale-canvas": "0.0.3",
"classnames": "^2.2.5",
"actionsheet": "^0.1.3",
"prop-detect": "^1.1.0",
"pinch-zoom": "^0.3.8",
"jr-qrcode": "^1.0.5",
"domify": "^1.4.0",
"component-classes": "^1.2.6",
"component-closest": "^1.0.1",
"component-emitter": "^1.2.1",
"component-event": "^0.2.0",
"component-events": "^1.0.10",
"component-file-picker": "^0.2.1",
"component-query": "0.0.3",
"component-querystring": "^2.0.0",
"component-raf": "^1.2.0",
"component-tap-event": "^1.1.4",
"component-tween": "^1.2.0",
"component-upload": "^0.3.0",
"nprogress": "^0.2.0",
"radio-component": "0.0.2",
"react": "^15.4.2",
"react-dom": "^15.4.2",
"koa-better-body": "^3.0.2",
"ei-loader": "^0.1.1",
"gulp": "^3.9.1",
"gulp-sourcemaps": "^2.4.0",
"gulp-util": "^3.0.8",
"html-loader": "^0.4.4",
"json-loader": "^0.5.4",
"webpack": "^1.14.0",
"webpack-stream": "^3.2.0"
},
"browser": {
"emitter": "component-emitter",
"querystring": "component-querystring",
"event": "component-event",
"tap-event": "component-tap-event",
"closest": "component-closest",
"tween": "component-tween",
"raf": "component-raf",
"classes": "component-classes",
"file-picker": "component-file-picker",
"upload": "component-upload",
"query": "component-query",
"events": "component-events",
"request": "request-component"
}
}

@chemzqm
Copy link
Collaborator

chemzqm commented Apr 21, 2018

@wind4gis 需要改这里 https://github.com/chemzqm/wept/blob/master/lib/util.js#L188
添加 babel 的 plugin,建议不要使用 wept 这个工具了。
想查看前端元素可以破解官方工具:

官方的开发者工具默认屏蔽了 UI 层的右键 inspect 功能,可以对官方开发者工具做些修改来开启右键(开启该功能会造成 wxml 面板不可用以及页面无法响应点击等严重 bug),首先使用 js-beautify 对代码批量格式化:

cd /Applications/wechatwebdevtools.app/Contents/Resources/app.nw
find . -type f -name '*.js' -not -path "./node_modules/*" -not -path "./modified_modules/*" -exec js-beautify -r -s 2 -p -f '{}' \;

注释掉文件 app/dist/app.js 44 行和 app/dist/components/simulator/webviewbody.js 149 行preventDefault 调用。101100 版本还需要修改 package.json 文件,去掉 --disable-devtools。最后重启开发者工具即可。

@wind4gis
Copy link
Author

我用的是windows系统,安装之后已经没有dist这个文件夹了,好像没法用这个方法去学习源码。使用wept主要是想研究学习下微信小程序的原理,网上找不到相关资料

@wind4gis
Copy link
Author

网上可以看到源码解析的,基本上是基于微信IDE0.9版本,一两年前的源码解析

@chemzqm
Copy link
Collaborator

chemzqm commented Apr 22, 2018

建议你本地 git clone, 然后执行 npm install, gulp build

@windhc
Copy link

windhc commented May 18, 2018

你好,这个问题目前有解决计划吗

@chemzqm
Copy link
Collaborator

chemzqm commented May 18, 2018

没有,项目不维护了,你把 wept 代码里使用到的 babel 配置升级下应该就可以了。

@chemzqm chemzqm closed this as completed May 18, 2018
@chemzqm chemzqm reopened this May 18, 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

3 participants