简体   繁体   English

为什么我没有从茉莉花节点得到任何输出?

[英]Why do I get no output from jasmine-node?

I'm running nodejs (v0.10.25) on Ubuntu 14.04. 我在Ubuntu 14.04上运行nodejs(v0.10.25)。 I've installed jasmine-node globally using npm as per the instructions here : http://help.exercism.io/getting-started-with-javascript.html . 我已经按照此处的说明使用npm在全球范围内安装了jasmine-node: http : //help.exercism.io/getting-started-with-javascript.html
My source file is bob.js and my spec file is called bob_test.spec.js . 我的源文件是bob.js ,我的规范文件称为bob_test.spec.js

When I try to run jasmine-node from the command line using: 当我尝试使用以下命令从命令行运行jasmine-node时:
~$jasmine-node bob_test.spec.js
I get no errors/output/anything from the program. 我没有从程序中得到任何错误/输出/任何信息。 I just get the command line prompt back. 我只是回到命令行提示符。

Running which jasmine-node points me to a script located at /usr/local/bin/jasmine-node which contains the following: 运行which jasmine-node我指向位于/usr/local/bin/jasmine-node的脚本,该脚本包含以下内容:

#!/usr/bin/env node

if( !process.env.NODE_ENV ) process.env.NODE_ENV = 'test';

var path = require('path');
require(path.join(__dirname,'../lib/jasmine-node/cli.js'));  

My $PATH includes /usr/local/bin: 我的$ PATH包括/ usr / local / bin:

I have tried: 我努力了:

  • uninstalling/reinstalling jasmine-node packages 卸载/重新安装茉莉节点包
  • uninstalling and reinstalling node/nodejs 卸载并重新安装node / nodejs
  • variations on the arguments to jasmine-node such as : 茉莉花节点的参数的变体,例如:
    • jasmine-node .
    • jasmine-node bob.js

Am I missing something in terms of configuration, or something else entirely? 我是否在配置方面缺少某些东西,或者完全缺少其他东西?

Check that the contents of the script that you're running uses the same command that you're using when you invoke node. 检查正在运行的脚本的内容是否与调用节点时使用的命令相同。 For instance, the contents of the jasmine-node script contains: 例如, jasmine-node脚本的内容包含:

#!/usr/bin/env node

if( !process.env.NODE_ENV ) process.env.NODE_ENV = 'test';

var path = require('path');
require(path.join(__dirname,'../lib/jasmine-node/cli.js'));

The first line contains #!/usr/bin/env node which indicates that node is used to run the code. 第一行包含#!/usr/bin/env node ,该node指示该node用于运行代码。 Verify that node is available and can execute that code. 验证node是否可用并可以执行该代码。

Installation on Ubuntu machines can be complicated (since there was an old nodejs binary). 在Ubuntu机器上的安装可能很复杂(因为有一个旧的nodejs二进制文件)。 I recommend using the following documentation to install Node on an Ubuntu machine: https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#debian-and-ubuntu-based-linux-distributions 我建议使用以下文档在Ubuntu机器上安装Node: https : //github.com/joyent/node/wiki/Installing-Node.js-via-package-manager#debian-and-ubuntu-based-linux-分布

Specifically it calls out using a different distribution repository. 具体来说,它使用其他分发存储库进行调用。 Using this in future installs helps get the correct node binary on the machine and in the PATH. 在以后的安装中使用此功能有助于在计算机上和PATH中获得正确的node二进制文件。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM