编译问题
在 npm run dev:weapp 命令下,
-
编写代码出现语法错误后,编译报错,但修改过后,会出现该文件没有被引入,不进行编译的提示,
-
多次遇到
TypeError: Cannot read property 'scope' of undefined这个问题,重启命令会出现Error: ENOTEMPTY: directory not empty, rmdir 'C:\git\weapp\dist\npm'这个问题,得手动删除 dist 文件夹才可以启动命令
你的代码是怎么写的,报错信息是什么
第一个问题 在 0.0.64 版本暂时没有发现, 但第二个问题嘛,在 0.0.63 倒是挺频繁的,我再试试看
这次问题在是直接重启命令时出现的: 报错如下
"C:\Program Files\JetBrains\WebStorm 2018.1\bin\runnerw.exe" "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\yarn\bin\yarn.js" run dev:weapp
yarn run v1.7.0
$ npm run build:weapp -- --watch
> [email protected] build:weapp C:\git\weapp
> taro build --type weapp "--watch"
👽 Taro v0.0.64
开始编译项目 js
C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:262
throw er
^
Error: ENOTEMPTY: directory not empty, rmdir 'C:\git\weapp\dist\npm\redux-logger'
at Object.fs.rmdirSync (fs.js:846:18)
at rmkidsSync (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:304:27)
at rmdirSync (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:281:7)
at rimrafSync (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:252:7)
at options.readdirSync.forEach.f (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:291:39)
at Array.forEach (<anonymous>)
at rmkidsSync (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:291:26)
at rmdirSync (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:281:7)
at Object.rimrafSync [as removeSync] (C:\git\weapp\node_modules\fs-extra\lib\remove\rimraf.js:252:7)
at items.forEach.item (C:\git\weapp\node_modules\fs-extra\lib\empty\index.js:39:12)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build:weapp: `taro build --type weapp "--watch"`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build:weapp 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\Administrator\AppData\Roaming\npm-cache\_logs\2018-07-03T06_13_08_425Z-debug.log
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
Process finished with exit code 1
这是第一个问题的 以下为组件代码
import Taro, { Component } from '@tarojs/taro'
import { View } from '@tarojs/components'
import './PageButton.scss'
export default class PageButton extends Component {
componentWillMount () { }
componentDidMount () { }
componentWillUnmount () { }
componentDidShow () { }
componentDidHide () { }
render () {
console.log(this.props.text)
return (
<View className='page-button'>
{this.props.text}
</View>
)
}
}
PageButton.defaultProps = {
text: '确定',
}
修改为以下后
PageButton.defaultProps = {
text: '确定',\
}
就会出现这个提示
警告 JS文件 src/components/public/PageButton/PageButton.js 没有被引用到,不会被编译
然后修改回来,还是这个提示
然后还有这个问题
生成 页面WXSS dist/pages/tools/addressEdit/index.wxss
修改 页面文件 src/pages/tools/addressEdit/index
编译 页面文件 src/pages/tools/addressEdit/index
生成 页面JSON dist/pages/tools/addressEdit/index.json
生成 页面JS dist/pages/tools/addressEdit/index.js
生成 页面WXML dist/pages/tools/addressEdit/index.wxml
生成 页面WXSS dist/pages/tools/addressEdit/index.wxss
修改 页面文件 src/pages/tools/addressEdit/index
编译 页面文件 src/pages/tools/addressEdit/index
生成 页面JSON dist/pages/tools/addressEdit/index.json
生成 页面JS dist/pages/tools/addressEdit/index.js
生成 页面WXML dist/pages/tools/addressEdit/index.wxml
生成 页面WXSS dist/pages/tools/addressEdit/index.wxss
修改 页面文件 src/pages/tools/addressEdit/index
编译 页面文件 src/pages/tools/addressEdit/index
TypeError: Cannot read property 'scope' of undefined
at transform (C:\git\weapp\node_modules\@tarojs\transformer-wx\lib\src\index.js:156:36)
at buildSinglePage (C:\git\weapp\node_modules\@tarojs\cli\src\weapp.js:695:29)
at FSWatcher.watcher.on.on.on (C:\git\weapp\node_modules\@tarojs\cli\src\weapp.js:1065:19)
at emitTwo (events.js:126:13)
at FSWatcher.emit (events.js:214:7)
at FSWatcher.<anonymous> (C:\git\weapp\node_modules\chokidar\index.js:199:15)
at FSWatcher._emit (C:\git\weapp\node_modules\chokidar\index.js:241:5)
at FSWatcher.<anonymous> (C:\git\weapp\node_modules\chokidar\lib\nodefs-handler.js:267:16)
at FSReqWrap.oncomplete (fs.js:153:5)
复现很简单,,就是在代码末尾增加一个空行,保存,删除空行,保存,然后就是交叉重复了,就总会看到这个 TypeError
#295
请问这个问题 0.0.68 还存在么
另外,出现这个报错,应该是页面的 render 方法没有返回 jsx
在 v0.0.68 ,这个问题还是存在的,然后页面的 render 方法是有返回 jsx 的,
问题的复现的话,发现是只要保存就有机率发生。
系统 win7,node v8.11.2,编辑器用了 webstrom,没有使用 safe write 功能
是一定几率出现,不是必现是么
一定几率出现,不是必现