简体   繁体   中英

Permission denied on running collectstatic with django-pipeline on Heroku

I have a Django 2.0 project that uses django-pipeline for static files with pipeline.compilers.sass.SASSCompiler compiler. It works perfectly in development, but when I deploy it on Heroku, I get the following error on running collectstatic:

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

Pipeline configuration:

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"
  }
}

I tried to install sass ("sass": "^1.9.0") with npm and change my pipeline config to

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

But it still fails with the same error:

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

From logs and heroku run bash I can see that all listed node packages where successfully installed. How can I fix this permission error?

The problem was with the path to node-sass . It had to be

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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