Невозможно установить узел в Heroku - PullRequest
1 голос
/ 22 апреля 2019

Я пытаюсь развернуть приложение Django на Heroku с установками узла и npm, однако при развертывании приложения на консоли Heroku появляется следующая ошибка:

 npm ERR! node v11.13.0
       npm ERR! npm  v2.15.12
       npm ERR! path /tmp/build_number/node_modules/.bin/grunt
       npm ERR! code ENOENT
       npm ERR! errno -2
       npm ERR! syscall unlink

       npm ERR! enoent ENOENT: no such file or directory, unlink '/tmp/build_number/node_modules/.bin/grunt'
       npm ERR! enoent This is most likely not a problem with npm itself
       npm ERR! enoent and is related to npm not being able to find a file.
       npm ERR! enoent 

       npm ERR! Please include the following file with any support request:
       npm ERR!     /tmp/build_number/npm-debug.log
-----> Build failed

Я пытаюсь построить диаграммы с использованием компонентов Vue.js, использующих пакеты сборки. Я хотел бы знать, как установить npm на Heroku. Любая помощь будет принята с благодарностью.

У меня есть следующая конфигурация для сайта:

Django версия: 2.1.7 Версия узла: 11.3.0 Версия Python: 3.7.3

Мой файл package.json выглядит следующим образом:

{
  "name": "django",
  "private": true,
  "scripts": {
    "start": "node app",
    "poststart": "npm prune --production",
    "pretest": "eslint django/ js_tests/admin/ js_tests/gis/",
    "test": "grunt test --verbose"
  },
  "engines": {
    "node": "11.13.0",
    "npm": ">=1.3.0 <3.0.0",
    "build": "bower install && grunt build",
    "start": "nf start"
  },
  "devDependencies": {
    "@babel/core": "^7.4.3",
    "@babel/plugin-transform-runtime": "^7.4.3",
    "@babel/preset-env": "^7.4.3",
    "@babel/runtime": "^7.4.3",
    "axios": "^0.18.0",
    "babel-loader": "^8.0.5",
    "babel-preset-es2015": "^6.24.1",
    "babel-preset-stage-0": "^6.24.1",
    "bootstrap-sass": "^3.4.1",
    "css-loader": "^2.1.1",
    "eslint": "^5.16.0",
    "grunt": "^1.0.1",
    "grunt-cli": "^1.2.0",
    "grunt-contrib-qunit": "^1.2.0",
    "jquery": "^3.3.1",
    "node-sass": "^4.11.0",
    "sass-loader": "^7.1.0",
    "style-loader": "^0.23.1",
    "vue": "^2.6.10",
    "vue-hot-reload-api": "^2.3.3",
    "vue-loader": "^15.7.0",
    "vue-template-compiler": "^2.6.10",
    "webpack": "^4.29.6",
    "webpack-bundle-tracker": "^0.4.2-beta",
    "webpack-cli": "^3.3.0"
  },
  "description": "FitGirl Inc",
  "version": "1.0.0",
  "main": "index.js",
  "repository": {
    "type": "git",
    "url": "git+https://github.com/uno-isqa-8950/fitgirl-inc.git"
  },
  "author": "hghanta",
  "license": "ISC",
  "bugs": {
    "url": "https://github.com/uno-isqa-8950/fitgirl-inc/issues"
  },
  "homepage": "https://github.com/uno-isqa-8950/fitgirl-inc#readme",
  "dependencies": {
    "chart.js": "^2.8.0",
    "vue-chartjs": "^3.4.2",
    "vue-cli": "^2.9.6"
  },
  "keywords": [
    "djano"
  ]
}

Мой ProcFile выглядит следующим образом:

web: node node_modules/gulp/bin/gulp build, gunicorn empoweru.wsgi:application --log-file -
'''

1 Ответ

0 голосов
/ 22 апреля 2019

В Heroku по умолчанию включен кеш модулей узлов.Поэтому, когда вы пытаетесь внести изменения в свой package.json, Heroku не распознает ваши изменения в devDependencies.Выполните эти два шага, и вы сможете развернуть его:

  1. Удалите grunt-cli из ваших devDependencies

  2. Запустите эту команду, чтобы отключить кэш

    heroku config:set NODE_MODULES_CACHE=false

  3. Разверните ваш код
...