collectfiles failed for pipeline / yUglify:系统找不到指定的路径 [英] collectfiles failes for pipeline / yUglify: The system cannot find the path specified

查看:366
本文介绍了collectfiles failed for pipeline / yUglify:系统找不到指定的路径的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我一直在试图让django管道工作,结合和缩小我的css和js资产。我似乎无法排除以下问题。当我运行:

  python manage.py collectstatic --noinput 

我收到错误:

  pipeline.exceptions.CompressorError:系统找不到指定的路径。 

我可能需要安装一些额外的包?如果是,那么怎么样?



我的django-pipeline设置:

  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':{
'静态/调查/ css / main.css',
},
'output_filename':'css / testme.css',
},
}

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

PIPELINE_ENABLED = True

这是完整的输出:

 追溯(最重要的是分号呼叫最后):
文件manage.py,第10行,< module>
execute_from_command_line(sys.argv)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\django\core\management\__init__ .py,行385,在execute_from_command_line
utility.execute()
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\django\\ \\ core \management\___it__。py,第377行,执行
self.fetch_command(子命令).run_from_argv(self.argv)
文件d:\Development\django\ TopDish\env_mrg_tacx_laptop\lib\site-packages\django\core\management\base.py,第288行,在run_from_argv
self.execute(* args,** options .__ dict__)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\django\core\management\base.py,第338行,执行
output = self.handle(* args,** opt离子)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\django\core\management\base.py,第533行, handle
return self.handle_noargs(** options)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\django\contrib\ staticfiles\management\commands\collectstatic.py,第168行,handle_noargs
已收集= self.collect()
文件d:\Development\django\TopDish\env_mrg_tacx_laptop \lib\site- packages\django\contrib\static-files\management\commands\collectstatic.py,第114行收集
for original_path,processed_pa​​th,处理器处理:
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\pipeline\storage.py,第36行,在post_process
packager.pack_javascr ipts(package)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\pipeline\packager.py,第112行,pack_javascripts
return self.pack(package,self.compressor.compress_js,js_compressed,templates = package.templates,** kwargs)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\\ \\ site-packages\pipeline\packager.py,第106行,包
content = compress(paths,** kwargs)
文件d:\Development\django\TopDish \env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\__init __。py,第67行,在compress_js
js = getattr(compression(verbose = self.verbose),'compress_js') (js)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\yuglify.py,第13行,在compress_js
return self.compress_common(js ,'js',settings.PIPELINE_YUGLIFY_JS_ARGUMENTS)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site-packages\pipeline\compressors\yuglify.py,第10行,在compress_common
返回self.execute_command(命令,内容)
文件d:\Development\django\TopDish\env_mrg_tacx_laptop\lib\site- packages\pipeline\\ \\ compressors\__init __。py,行240,在execute_command
raise CompressorError(stderr)
pipeline.exceptions.CompressorError:系统找不到指定的路径。

更新



我试过了再次使用另一台压缩机:

  PIPELINE_CSS_COMPRESSOR ='pipeline.compressors.csstidy.CSSTidyCompressor'

这给出了完全相同的结果,我该怎么做错?



更新2



如果我将压缩器设置为无,一切正常,即文件合并并放在静态文件夹中。他们也正确地服务。

  PIPELINE_CSS_COMPRESSOR =无
PIPELINE_JS_COMPRESSOR =无

所以它必须是访问或使用压缩器的东西。我在Windows上运行。



更新3



我已经添加了一些print()命令到 init .py in / site-packages / pipeline / compressors /

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

命令是:/ usr / bin / env / yuglify --type = css --terminal
哪些(可能?)在Windows上不起作用



然后,我尝试将其部署到AWS Elastic Beanstalk,但是我也收到错误:

  INFO:环境更新正在开始。 
INFO:将新版本部署到实例。
错误:[实例:i-75dc5e91模块:AWSEBAutoScalingGroup ConfigSet:null]命令在实例上失败。返回代码:1输出:[CMD-AppDeploy / AppDeployStage0 / EbExtensionPostBuild]命令失败,出现错误代码1:构建期间发生错误:命令01_collectstatic失败。
INFO:在所有实例上完成命令执行。总结:[成功:0,失败:1]。
INFO:新应用程序版本已部署到运行EC2实例。
错误:更新环境操作已完成,但出现错误。有关详细信息,请参阅疑难解答文档。
错误:更新环境操作已完成,但出现错误。有关详细信息,请参阅疑难解答文档。

我知道可以手动设置压缩机仓的位置,但是哪里可以设置弹性Beanstalk?



任何建议如何排序?

解决方案

我已经通过在.ebextensions / app.config文件中添加命令来修复它:

 #这些命令在应用程序之前运行, web服务器是
#设置和应用程序版本文件被提取
命令:
01_node_install:
#从/ tmp目录运行此命令
cwd:/ tmp
#如果节点已经安装(文件/ usr / bin / node),则不运行命令
test:'[! -f / usr / bin / node]&& echonode not installed'
#从epel库中安装
#flag -y用于无交互安装
命令:'yum install -y nodejs npm --enablerepo = epel'
命令:'npm -g install yuglify'

根据我在 http://qpleple.com/install-nodejs-on-elastic-beanstalk/


I've been trying to get django-pipeline to work to combine and minify my css and js assets. I don't seem to be able to sort the following issue out. When I run:

python manage.py collectstatic --noinput

I get an error:

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

Do I maybe need to install some additional packages? If so, how?

My settings for django-pipeline:

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

This is the complete output:

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

I've tried it again using another compressor:

PIPELINE_CSS_COMPRESSOR = 'pipeline.compressors.csstidy.CSSTidyCompressor'

This gives the exact same result, what could I be doing wrong?

UPDATE 2

If I set the compressors to None everything works, i.e. the files get combined and placed in the static files folder. They are also served correctly.

PIPELINE_CSS_COMPRESSOR = None
PIPELINE_JS_COMPRESSOR = None

So it must be something either in accessing or using the compressors. I'm running on Windows.

UPDATE 3

I've added some print() commands to init.py in /site-packages/pipeline/compressors/

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

The command is: /usr/bin/env/ yuglify --type=css --terminal Which can (probably?) never work on Windows.

I've then tried to deploy it to AWS Elastic Beanstalk, but I get an error then as well:

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.

I know it's possible to manually set the location of the compressors bin, but where to set it for Elastic Beanstalk?

Any suggestions how to sort this out?

解决方案

I've fixed it by adding commands to the .ebextensions/app.config file:

# 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'

Based these commands on what I found on http://qpleple.com/install-nodejs-on-elastic-beanstalk/

这篇关于collectfiles failed for pipeline / yUglify:系统找不到指定的路径的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆