2015-03-02 92 views
1

我一直試圖讓django-pipeline工作來組合和縮小我的css和js資產。我似乎無法排除以下問題。當我運行:用於管道的collectfiles失敗/ yUglify:系統找不到指定的路徑

​​

我得到一個錯誤:

pipeline.exceptions.CompressorError: The system cannot find the path specified. 

難道我也許需要安裝一些額外的軟件包?如果是這樣,怎麼樣?

我的Django的管道設置:

STATICFILES_STORAGE = 'pipeline.storage.PipelineCachedStorage' 
STATICFILES_FINDERS = (
    'django.contrib.staticfiles.finders.FileSystemFinder', 
    'django.contrib.staticfiles.finders.AppDirectoriesFinder', 
    'pipeline.finders.PipelineFinder', 
) 

PIPELINE_CSS = { 
    'testme': { 
     'source_filenames': { 
      'static/surveys/css/main.css', 
     }, 
     'output_filename': 'css/testme.css', 
    }, 
} 

PIPELINE_JS = { 
    'testmejs': { 
     'source_filenames': { 
      'surveys/js/gklib.js', 
     }, 
     'output_filename': 'surveys/js/testmejs.css', 
    }, 
} 

PIPELINE_ENABLED = True 

這是完整的輸出:

PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.csstidy.CSSTidyCompressor' 

Traceback (most recent call last): 
    File "manage.py", line 10, in <module> 
    execute_from_command_line(sys.argv) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\__init__.py", line 385, in execute_from_command_line 
    utility.execute() 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\__init__.py", line 377, in execute 
    self.fetch_command(subcommand).run_from_argv(self.argv) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py", line 288, in run_from_argv 
    self.execute(*args, **options.__dict__) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py", line 338, in execute 
    output = self.handle(*args, **options) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py", line 533, in handle 
    return self.handle_noargs(**options) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 168, in handle_noargs 
    collected = self.collect() 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\contrib\staticfiles\management\commands\collectstatic.py", line 114, in collect 
    for original_path, processed_path, processed in processor: 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\storage.py", line 36, in post_process 
    packager.pack_javascripts(package) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\packager.py", line 112, in pack_javascripts 
    return self.pack(package, self.compressor.compress_js, js_compressed, templates=package.templates, **kwargs) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\packager.py", line 106, in pack 
    content = compress(paths, **kwargs) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\__init__.py", line 67, in compress_js 
    js = getattr(compressor(verbose=self.verbose), 'compress_js')(js) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\yuglify.py", line 13, in compress_js 
    return self.compress_common(js, 'js', settings.PIPELINE_YUGLIFY_JS_ARGUMENTS) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\yuglify.py", line 10, in compress_common 
    return self.execute_command(command, content) 
    File "d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\__init__.py", line 240, in execute_command 
    raise CompressorError(stderr) 
pipeline.exceptions.CompressorError: The system cannot find the path specified. 

UPDATE

我又用另一個壓縮機試了一下

這給出了完全相同的結果,我可能做錯了什麼?

更新2

如果我設置爲無一切正常壓縮機,即文件得到合併,並放置在靜態文件的文件夾。他們也正確地服務。

PIPELINE_CSS_COMPRESSOR = None 
PIPELINE_JS_COMPRESSOR = None 

所以它必須是在訪問或使用壓縮機的東西。我在Windows上運行。

更新3

我已經添加了一些打印()命令初始化的.py在/站點包/管道/壓縮機/

class SubProcessCompressor(CompressorBase): 
    def execute_command(self, command, content): 
     import subprocess 
     print("Command: " + command) 

的命令是:在/ usr/bin中/ env/yuglify --type = css --terminal 哪些可能(可能?)從不在Windows上工作。

我又試圖將其部署到AWS彈性魔豆,但我得到一個錯誤,那麼還有:

INFO: Environment update is starting. 
INFO: Deploying new version to instance(s). 
ERROR: [Instance: i-75dc5e91 Module: AWSEBAutoScalingGroup ConfigSet: null] Command failed on instance. Return code: 1 Output: [CMD-AppDeploy/AppDeployStage0/EbExtensionPostBuild] command failed with error code 1: Error occurred during build: Command 01_collectstatic failed. 
INFO: Command execution completed on all instances. Summary: [Successful: 0, Failed: 1]. 
INFO: New application version was deployed to running EC2 instances. 
ERROR: Update environment operation is complete, but with errors. For more information, see troubleshooting documentation. 
ERROR: Update environment operation is complete, but with errors. For more information, see troubleshooting documentation. 

我知道這是可以手動設置壓縮機倉的位置,但在哪裏爲Elastic Beanstalk設置它?

任何建議如何解決這個問題?

+0

注意論據現在正處於一個管道對象發現這些命令,所以 '''PIPELINE = { ... 'CSS_COMPRESSOR':None, 'JS_COMPRESSOR':None, }''' – 2016-01-29 02:24:02

回答

0

我已通過添加命令到.ebextensions/app.config文件固定它:

# these commands run before the application and web server are 
# set up and the application version file is extracted 
commands: 
    01_node_install: 
    # run this command from /tmp directory 
    cwd: /tmp 
    # don't run the command if node is already installed (file /usr/bin/node exists) 
    test: '[ ! -f /usr/bin/node ] && echo "node not installed"' 
    # install from epel repository 
    # flag -y for no-interaction installation 
    command: 'yum install -y nodejs npm --enablerepo=epel' 
    command: 'npm -g install yuglify' 

基於我對http://qpleple.com/install-nodejs-on-elastic-beanstalk/

+0

'yum install -y nodejs npm --enablerepo = epel'和'npm -g install yuglify'最好分成2個獨立的命令,例如。 '01_node_install'和'02_yuglify_install'。 – greenafrican 2015-06-19 08:48:46

相關問題