简体   繁体   English

Heroku部署,使用Django管道Yuglify没有这样的文件

[英]Heroku Deployment, Yuglify No Such File with Django pipeline

Trying to run collectstatic on deloyment, but running into the following error: 尝试在解除部署时运行collectstatic,但遇到以下错误:

pipeline.exceptions.CompressorError: /usr/bin/env: yuglify: No such file or directory pipeline.exceptions.CompressorError:/ usr / bin / env:yuglify:没有这样的文件或目录

When I run collectstatic manually, everything works as expected: 当我手动运行collectstatic时,一切都按预期工作:

Post-processed 'stylesheets/omnibase-v1.css' as 'stylesheets/omnibase-v1.css' Post-processed 'js/omnijs-v1.js' as 'js/omnijs-v1.js' 后处理为'stylesheets / omnibase-v1.css'的'stylesheets / omnibase-v1.css'后处理为'js / omnijs-v1.js'的后处理'js / omnijs-v1.js'

I've installed Yuglify globally. 我已经在全球范围内安装了Yuglify。 If I run 'heroku run yuglify', the interface pops up and runs as expected. 如果我运行“ heroku run yuglify”,则该界面会弹出并按预期运行。 I'm only running into an issue with deployment. 我只是遇到部署问题。 I'm using the multibuildpack, with NodeJS and Python. 我正在使用带有NodeJS和Python的multibuildpack。 Any help? 有什么帮助吗?

My package, just in case: 我的包裹,以防万一:

{
  "author": "One Who Sighs",
  "name": "sadasd",
  "description": "sadasd Dependencies",
  "version": "0.0.0",
  "homepage": "http://sxaxsaca.herokuapp.com/",
  "repository": {
    "url": "https://github.com/heroku/heroku-buildpack-nodejs"
  },
  "dependencies": {
    "yuglify": "~0.1.4"
  },
  "engines": {
    "node": "0.10.x"
  }
}

Should maybe mention that Yuglify is not in my requirements.txt, just in my package.json. 也许应该提到Yuglify不在我的requirements.txt中,而是在我的package.json中。

I ran into the same problem and ended up using a custom buildpack such as this and writing a bash script to install node and yuglify: https://github.com/heroku/heroku-buildpack-python 我遇到了同样的问题,最终使用了这样的自定义buildpack,并编写了一个bash脚本来安装node和yuglify: https : //github.com/heroku/heroku-buildpack-python

After setting the buildpack, I created a few bash scripts to install node and yuglify. 设置好buildpack之后,我创建了一些bash脚本来安装node和yuglify。 the buildpack has hooks to call these post compile scripts. buildpack具有挂钩来调用这些后编译脚本。 Here's a good example how to do this which I followed: https://github.com/nigma/heroku-django-cookbook 这是我遵循的一个很好的例子: https : //github.com/nigma/heroku-django-cookbook

These scripts are placed under bin in your root folder. 这些脚本放置在根文件夹中的bin下。

In the post_compile script, I added a script to install yuglify. 在post_compile脚本中,我添加了一个脚本来安装yuglify。

post_compile script post_compile脚本

if [ -f bin/install_nodejs ]; then
    echo "-----> Running install_nodejs"
    chmod +x bin/install_nodejs
    bin/install_nodejs


    if [ -f bin/install_yuglify ]; then
        echo "-----> Running install_yuglify"
        chmod +x bin/install_yuglify
        bin/install_yuglify
    fi

fi

install_yuglify script install_yuglify脚本

  #!/usr/bin/env bash
    set -eo pipefail

    npm install -g yuglify

If that doesn't work, you can have a look at this post: Yuglify compressor can't find binary from package installed through npm 如果不行,您可以看一下这篇文章: Yuglify压缩器无法从通过npm安装的软件包中找到二进制文件

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

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