django - 在 Heroku 上使用 django-pipeline 运行 collectstatic 的权限被拒绝
问题描述
我有一个 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
我可以看到所有列出的节点包都已成功安装。如何解决此权限错误?
解决方案
问题出在路径上node-sass
。它必须是
PIPELINE['SASS_BINARY'] = '/app/node_modules/.bin/node-sass'
推荐阅读
- linux - 有什么方法可以将 snap 与 crouton 集成在一起吗?
- python - 使用唯一键和条件合并两个熊猫数据框
- java - 如何编写jsp代码以接受来自固定商店的订单并显示并包含用户可以选择和订购的物品列表
- php - 减少 if elseif 块 Laravel 过滤器
- wordpress - 如何在 html 页面中显示 [woocommerce_my_account] 短代码
- python-3.x - 为什么我在 python 中运行此代码时出现输入错误?
- angular - Angular 6 服务工作者正在缓存字体真棒图标,无法在离线模式下检索它们
- php - 使用 JQuery 在不刷新页面的情况下将数据插入数据库,多次插入单行
- teiid - Teiid 查询解析器未识别引用的标识符
- sapui5 - 操作表格最后一行的图标属性