【发布时间】:2018-07-11 16:40:48
【问题描述】:
我有一个 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"
}
}
我尝试使用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