nodeenv:尝试启动env时出错

时间:2012-12-14 12:59:10

标签: node.js

尝试使用nodeenv启动虚拟环境时出错:

$ nodeenv env

 * Install node.js (0.8.16) ..Traceback (most recent call last):
  File "/usr/local/bin/nodeenv", line 9, in <module>
    load_entry_point('nodeenv==0.6.0', 'console_scripts', 'nodeenv')()
  File "/usr/local/lib/python2.7/dist-packages/nodeenv-0.6.0-py2.7.egg/nodeenv.py", line 494, in main
    create_environment(env_dir, opt)
  File "/usr/local/lib/python2.7/dist-packages/nodeenv-0.6.0-py2.7.egg/nodeenv.py", line 410, in create_environment
    install_node(env_dir, src_dir, opt)
  File "/usr/local/lib/python2.7/dist-packages/nodeenv-0.6.0-py2.7.egg/nodeenv.py", line 332, in install_node
    callit(['make'], opt.verbose, True, node_src_dir, env)
  File "/usr/local/lib/python2.7/dist-packages/nodeenv-0.6.0-py2.7.egg/nodeenv.py", line 263, in callit
    % (cmd_desc, proc.returncode))
OSError: Command make failed with error code 2

网上没有找到关于此错误的任何内容,您能给我一些帮助吗?

2 个答案:

答案 0 :(得分:15)

好吧,通过使用详细模式得到它:

$ nodeenv env -v

g ++缺失

sudo apt-get install build-essential g++

解决它!

答案 1 :(得分:2)

除了@ denis89所提到的,我添加&#39; -v&#39;选项,我发现nodeenv报告:

&#39; g ++:内部编译器错误:已杀死(程序cc1plus)&#39;。

用谷歌搜索后我得出结论,机器的内存不足。因为我在Vagrant中运行nodeenv,所以很容易改变内存:

config.vm.provider "virtualbox" do |v|
    v.name = "working"
    v.memory = 2048
end

愿这个答案有所帮助。