Node.js应用程序无法部署到Heroku

时间:2017-07-01 09:56:21

标签: node.js heroku npm yarnpkg node-sass

我尝试将应用程序部署到Heroku。应用程序仅在更改引擎版本后才能成功部署。如果我尝试部署而没有修改"引擎"部分,部署失败并显示以下错误:

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'

这是我的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"
  }
}

也许你有任何解决方案,除了更改引擎版本?

2 个答案:

答案 0 :(得分:1)

我在Heroku上找到了解决方案 - 已禁用的节点模块缓存:

#include <PS2X_lib.h>  //for v1.6
#include "Joystick.h"
#include<SoftwareSerial.h>


Joystick_ Joystick(JOYSTICK_DEFAULT_REPORT_ID, JOYSTICK_TYPE_GAMEPAD,
    12, 2, // Button Count, Hat Switch Count
    true, true, true, // X and Y, but no Z Axis
    false, false, true, // No Rx, Ry, or Rz
    false, false, // No rudder or throttle
    false, false, false);  // No accelerator, brake, or steering

#define PS2_DAT        3  //14    
#define PS2_CMD        2  //15
#define PS2_SEL        12  //16
#define PS2_CLK        13  //17

//#define pressures true
#define pressures false
//#define rumble true
#define rumble false

const bool testAutoSendMode = false;
SoftwareSerial BTSerial(11, 10);
PS2X ps2x;

int error = 0;
byte type = 0;
byte vibrate = 0;

void setup() {
  SoftwareSerial BTSerial(11, 10);
  BTSerial.begin(57600);
  Serial.begin(57600);
  delay(300);
  Joystick.begin();
  //setup pins and settings: GamePad(clock, command, attention, data, Pressures?, Rumble?) check for error
  error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT, true, false);
  type = ps2x.readType();
  Joystick.setXAxisRange(0, 255);
  Joystick.setZAxisRange(0, 255);
  Joystick.setYAxisRange(0, 255);
  Joystick.setRzAxisRange(0, 255);
}

byte ReadOneByte() {
  int ByteRead;
  while (!BTSerial.available());
  ByteRead = BTSerial.read();
  return ByteRead;
}

void loop() {
  ReadOneByte() ;
  // Always be getting fresh data
  if (error == 1) //skip loop if no controller found
    return;
  error = ps2x.config_gamepad(PS2_CLK, PS2_CMD, PS2_SEL, PS2_DAT, pressures, rumble);
  ps2x.read_gamepad(false, 0);
  Joystick.setButton(0, ps2x.Button(PSB_TRIANGLE));
  Joystick.setButton(1, ps2x.Button(PSB_CIRCLE));
  Joystick.setButton(2, ps2x.Button(PSB_CROSS));
  Joystick.setButton(3, ps2x.Button(PSB_SQUARE));
  Joystick.setButton(4, ps2x.Button(PSB_L2));
  Joystick.setButton(5, ps2x.Button(PSB_R2));
  Joystick.setButton(6, ps2x.Button(PSB_L1));
  Joystick.setButton(7, ps2x.Button(PSB_R1));
  Joystick.setButton(8, ps2x.Button(PSB_SELECT));
  Joystick.setButton(9, ps2x.Button(PSB_START));
  Joystick.setButton(10, ps2x.Button(PSB_L3));
  Joystick.setButton(11, ps2x.Button(PSB_R3));
  Joystick.setXAxis(ps2x.Analog(PSS_LX));
  Joystick.setYAxis(ps2x.Analog(PSS_LY));
  Joystick.setZAxis(ps2x.Analog(PSS_RY));
  Joystick.setRzAxis(ps2x.Analog(PSS_RX));
  if (ps2x.Button(PSB_PAD_UP)) { //will be TRUE as long as button is pressed
    Joystick.setYAxis(0);
  }
  if (ps2x.Button(PSB_PAD_RIGHT)) {
    Joystick.setXAxis(255);
  }
  if (ps2x.Button(PSB_PAD_LEFT)) {
    Joystick.setXAxis(0);
  }
  if (ps2x.Button(PSB_PAD_DOWN)) {
    Joystick.setYAxis(255);
  }
}

答案 1 :(得分:0)

这是解决此问题的解决方案:

pandas.cut

或者,对于"scripts": { "heroku-postbuild": "yarn add --force node-sass" }

npm

请参阅:

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

和:

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