【问题标题】:How to run Jison tests with Node.js?如何使用 Node.js 运行 Jison 测试?
【发布时间】:2012-04-02 13:18:46
【问题描述】:

尝试运行 Jison 单元测试,但命令失败。 我该如何解决?

$ git clone git://github.com/zaach/jison.git
Cloning into 'jison'...
remote: Counting objects: 2667, done.
remote: Compressing objects: 100% (1106/1106), done.
remote: Total 2667 (delta 1523), reused 2644 (delta 1501)
Receiving objects: 100% (2667/2667), 731.51 KiB | 129 KiB/s, done.
Resolving deltas: 100% (1523/1523), done.

$ cd jison/
$ make test
node tests/all-tests.js

node.js:201
        throw e; // process.nextTick error, or 'error' event on first tick
              ^
Error: Cannot find module 'jison'
    at Function._resolveFilename (module.js:332:11)
    at Function._load (module.js:279:25)
    at Module.require (module.js:354:17)
    at new require (module.js:370:17)
    at /private/tmp/jison/lib/jison/ebnf.js:43:18
    at Object.<anonymous> (/private/tmp/jison/lib/jison/ebnf.js:150:2)
    at Module._compile (module.js:441:26)
    at Object..js (module.js:459:10)
    at Module.load (module.js:348:31)
    at Function._load (module.js:308:12)
make: *** [test] Error 1

【问题讨论】:

    标签: javascript parsing node.js jison


    【解决方案1】:

    make test 之前添加一个npm install

    【讨论】:

    • 这会将我的 fork 添加到节点的路径中,还是将其复制到 /usr/local 下的某个位置?我的目标是能够添加更多测试并针对修改后的 jison 代码运行它们。
    • 否;这将在./node_modules 中安装项目的依赖项。
    【解决方案2】:

    我用来修复错误的命令:

    npm install
    rm -rf node_modules/jison
    ln -s ../ node_modules/jison
    

    npm install 将所有依赖项下载到 ./node_modules,但其中包括 jison 的副本。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2013-08-22
      • 2017-01-24
      • 2015-05-24
      • 1970-01-01
      • 2018-07-06
      • 2014-02-18
      • 2019-07-19
      相关资源
      最近更新 更多