【问题标题】:Permission denied on running collectstatic with django-pipeline on Heroku在 Heroku 上使用 django-pipeline 运行 collectstatic 的权限被拒绝
【发布时间】:2018-07-11 16:40:48
【问题描述】:

我有一个 Django 2.0 项目,它使用 django-pipelinepipeline.compilers.sass.SASSCompiler 编译器生成静态文件。它在开发中完美运行,但是当我在 Heroku 上部署它时,运行 collectstatic 时出现以下错误:

pipeline.exceptions.CompilerError: [Errno 13] Permission denied: '/app/node_modules/.bin'

管道配置:

PIPELINE['SASS_BINARY'] = '/app/node_modules/.bin node-sass'

package.json:

{
  "name": "myprojectname",
  "version": "1.0.0",
  "engines": {
    "node": "8.11.3"
  },
  "description": "myprojectdescription",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1",
    "postinstall": "bower install"
  },
  "dependencies": {
    "bower": "^1.8.4",
    "node-sass": "^4.9.2",
    "yuglify": "^2.0.0"
  } 
}

bower.json:

{
  "name": "myprojectname",
  "main": "index.js",
  "private": true,
  "ignore": [
    "**/.*",
    "node_modules",
    "bower_components",
    "app/static/bower_components",
    "test",
    "tests"
  ],
  "dependencies": {
    "bootstrap4": "bootstrap#^4.1.1",
    "bootstrap-datepicker": "^1.8.0",
    "font-awesome": "^5.1.0"
  }
}

我尝试使用npm 安装sass ("sass": "^1.9.0") 并将我的管道配置更改为

PIPELINE['SASS_BINARY'] = '/app/.heroku/node/bin sass'

但它仍然失败并出现同样的错误:

pipeline.exceptions.CompilerError: [Errno 13] Permission denied: '/app/.heroku/node/bin'

从日志和heroku run bash 我可以看到所有列出的节点包都已成功安装。如何解决此权限错误?

【问题讨论】:

    标签: django heroku sass node-sass django-pipeline


    【解决方案1】:

    问题出在node-sass 的路径上。应该是

    PIPELINE['SASS_BINARY'] = '/app/node_modules/.bin/node-sass'
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2020-11-03
      • 1970-01-01
      • 2020-02-03
      • 2018-07-28
      • 2021-10-08
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多