0

I trying to deploy application to Heroku. Application successfully deploys only after changing engine versions. If i try to deploy without modify "engines" section, deploy fails with this errors:

remote:        ERROR in ./resources/assets/sass/app.scss
remote:        Module build failed: ModuleBuildError: Module build failed: Error: ENOENT: no such file or directory, scandir '/tmp/build_7b88e5ab3110a2273bdb09b2d4f7c673/node_modules/node-sass/vendor'

This is my package.json

{
  "private": true,
  "name": "instagram",
  "description": "<p align=\"center\"><img src=\"https://laravel.com/assets/img/components/logo-laravel.svg\"></p>",
  "version": "1.0.0",
  "main": "webpack.config.js",
  "directories": {
    "test": "tests"
  },
  "engines" : {
    "npm" : "5.0.4",
    "node": "7.4.0",
    "yarn": "0.24.6"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "bootstrap": "^3.3.7",
    "bootstrap-notify": "^3.1.3",
    "bootstrap-sass": "^3.3.7",
    "bootstrap-switch": "^3.3.4",
    "css-loader": "^0.28.4",
    "cssnano": "^3.10.0",
    "extract-text-webpack-plugin": "^2.1.2",
    "file-loader": "^0.11.2",
    "font-awesome": "^4.7.0",
    "jquery": "^3.2.1",
    "knockout": "^3.4.2",
    "node-sass": "^4.5.3",
    "nprogress": "^0.2.0",
    "optimize-css-assets-webpack-plugin": "^2.0.0",
    "sass-loader": "^6.0.6",
    "select2": "^4.0.3",
    "uglifyjs-webpack-plugin": "^0.4.6",
    "url-loader": "^0.5.9",
    "webpack": "^2.2.0",
    "webpack-cleanup-plugin": "^0.5.1"
  },
  "scripts": {
    "dev": "npm run development",
    "development": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch": "cross-env NODE_ENV=development node_modules/webpack/bin/webpack.js --watch --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js",
    "watch-poll": "npm run watch -- --watch-poll",
    "hot": "cross-env NODE_ENV=development node_modules/webpack-dev-server/bin/webpack-dev-server.js --inline --hot --config=node_modules/laravel-mix/setup/webpack.config.js",
    "prod": "npm run production",
    "production": "cross-env NODE_ENV=production node_modules/webpack/bin/webpack.js --progress --hide-modules --config=node_modules/laravel-mix/setup/webpack.config.js"
  }
}

Maybe you have any solution except changing engines version?

2 Answers 2

1

I found solution - disabled node modules cache on Heroku:

heroku config:set NODE_MODULES_CACHE=false
$ git commit -am 'disable node_modules cache' --allow-empty
$ git push heroku master
Sign up to request clarification or add additional context in comments.

Comments

0

This is the solution that solves this problem:

"scripts": {
  "heroku-postbuild": "yarn add --force node-sass"
}

or, for npm:

"scripts": {
  "heroku-postbuild": "npm rebuild node-sass"
}

See:

https://github.com/sass/node-sass/issues/1387#issuecomment-185451183

and:

https://github.com/rails/webpacker/issues/422#issuecomment-304018204

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.