我已经与 yeoman 启动了一个 React-fullstack 项目。当我对其进行更改时,有一个观察程序会更新 Jade 文件,而无需我保存。正如您所想象的那样,我的控制台如下所示:
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
[BS] File changed: build/content/index.jade
但是,每当进行更改时,Webstorm 10 的 Run
部分就会出现错误:
/usr/local/bin/jade index.jade
/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:939
throw err;
^
SyntaxError: Assigning to rvalue (5:0)
at Parser.pp.raise (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:937:13)
at Parser.pp.checkLVal (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:1216:12)
at Parser.pp.parseMaybeUnary (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:193:22)
at Parser.pp.parseExprOps (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:152:19)
at Parser.pp.parseMaybeConditional (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:134:19)
at Parser.pp.parseMaybeAssign (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:112:19)
at Parser.pp.parseExpression (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:86:19)
at Parser.pp.parseStatement (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:1728:23)
at Parser.pp.parseTopLevel (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:1644:21)
at Parser.parse (/usr/local/lib/node_modules/jade/node_modules/acorn/dist/acorn.js:1614:17)
Process finished with exit code 1
只要文件发生更改,此消息就会在“运行”窗口中弹出,但它似乎不会导致更新文件时出现实际问题。
您遇到过这个错误吗?如何防止出现此错误,为什么它与 acorn.js 有关?
最佳答案
您应该从 *.jade 文件开头的代码中删除 ---
。
例如,您可以在index.jade中看到它:
---
title: React.js Starter Kit
component: ContentPage
---
div.row
div.col-sm-4
h3 Runtime Components
dl
关于reactjs - 在react-fullstack中更改文件时出现Jade Run错误,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33588736/