Yuglify压缩机通过npm无法从安装包中找到二进制文件 [英] Yuglify compressor can't find binary from package installed through npm
问题描述
我有一个新的virtualenv环境,并得到最新的django-pipleline。
I have a fresh virtualenv environment and have got the latest django-pipleline.
使用Closure的JS压缩是完美的,但是随着Yuglify的CSS压缩失败,原因是节点错误:
The JS compression with Closure works perfect, but CSS compression with Yuglify fails, due a node error:
STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage'
PIPELINE_JS_COMPRESSOR = 'pipeline.compressors.closure.ClosureCompressor'
PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.yuglify.YuglifyCompressor'
当我尝试收集静态:
./manage.py collectstatic
它说:
pipeline.compressors.CompressorError: /usr/bin/env: node: No such file or directory
但是我已经清楚地安装了yuglify甚至全局: p>
But I have clearly installed yuglify even as global:
sudo npm -g install yuglify
/usr/local/bin/yuglify -> /usr/local/lib/node_modules/yuglify/bin/yuglify
yuglify@0.1.2 /usr/local/lib/node_modules/yuglify
├── uglify-js@1.3.4
├── ycssmin@1.0.1
└── nopt@2.1.1
尝试在设置中设置biney无法帮助:
Trying to set the biney in settings doesn't help either:
PIPELINE_YUGLIFY_BINARY = '/usr/local/bin/yuglify'
我仍然收到相同的错误。为什么现在有这样的问题?有没有什么我必须另外设置?
I still get the same error. Why now such problems with npm? Is there something I have to setup additionally?
或者,有没有办法安装yuglify与pip?
Alternatively is there a way to install yuglify with pip?
许多谢谢,
推荐答案
经过3个小时的苦难,我找到了解决方案。
After 3 hours of suffering, I have found the solution.
这是因为错误的错误发生,如果从包管理器(npm)安装,您的bin可能被称为nodejs,因此您只需要像下面那样进行符号链接:
This is happening because of a misnaming error, if you install from a package manager (npm) your bin may be called nodejs so you just need to symlink it like this:
ln -s /usr/bin/nodejs /usr/bin/node
现在它正在工作。旧版本没有发生,这是新的东西。但至少它正在工作。我希望这有助于别人在那里。 :)
Now it is working. This didn't happen with the older version, its is something new. But at least it is working again. I hope this helps someone else out there. :)
这篇关于Yuglify压缩机通过npm无法从安装包中找到二进制文件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!