3

我在 Windows 上运行 jasmine-node 测试。我的 package.json 中有以下命令。

"scripts": {
    "test": "./node_modules/.bin/jasmine-node --coffee sample_spec.coffee",
  }

当我运行 npm test 时,我收到以下错误:

TypeError: Cannot read property '1' of null
    at Object.<anonymous> (C:\Documents and Settings\rohan\RubymineProjects\Node
Demo\node_modules\jasmine-node\lib\jasmine-node\index.js:24:57)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (C:\Documents and Settings\rohan\RubymineProjects\Node
Demo\node_modules\jasmine-node\lib\jasmine-node\cli.js:1:77)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
npm ERR! Test failed.  See above for more details.
npm ERR! not ok code 0
4

2 回答 2

0

可能不是解决问题的最佳方法,但我安装了 cygwin 并通过它运行了我所有的 jasmine 命令。通过 Windows 中的命令行使用 jasmine 等模块时,让生活更轻松。

于 2015-07-06T17:29:47.727 回答
0

所以在花了几个小时的工作之后,我找到了原因和解决方案 https://github.com/json5/json5/issues/4#issuecomment-5967750

我们必须在我们的 Windows 上更新 npm :)

于 2018-04-12T09:48:20.983 回答