0

我有一个 Django 2.0 项目,用于带有编译器django-pipeline的静态文件。pipeline.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"
  }
}

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

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

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

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

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

4

1 回答 1

0

问题出在路径上node-sass。它必须是

PIPELINE['SASS_BINARY'] = '/app/node_modules/.bin/node-sass'
于 2018-07-12T16:07:17.210 回答