reactjs - 在react-fullstack中更改文件时出现Jade Run错误

标签 reactjs pug yeoman

我已经与 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/

相关文章:

node.js - Express: 500 ReferenceError <函数名>未定义错误

AngularJS 和 Karma,无法调用未定义的方法 'module'

yeoman - 在哪里更改应用程序的名称?

javascript - 如何递归遍历react树并获取react元素的状态?

javascript - 如何将变量从 Jade 模板文件传递到脚本文件?

reactjs - Typescript - 在 Redux 中定义初始状态时设置 null 属性的类型

javascript - Jade 条件语句呈现为纯文本

javascript - Yeoman Webapp Generator 创建的项目中的 HTML5 Boilerplate 位于何处?

javascript - 构建我的 React/Redux 应用程序以提高效率

node.js - 在 AWS 中部署和运行 Docker