我正在尝试在具有节点和npm安装的Heroku上部署Django应用程序,但是,在部署该应用程序时,我在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
我正在尝试使用使用buildpacks的Vue.js组件来构建图表。我想知道如何在Heroku上安装npm。任何帮助将不胜感激。
我对网站具有以下配置:
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 -
'''
答案 0 :(得分:0)
Heroku默认情况下启用了Node模块缓存。因此,当您尝试对package.json进行更改时,Heroku无法识别对devDependencies的更改。请遵循以下两个步骤,您应该可以部署它:
从devDependencies中删除grunt-cli
运行此命令以禁用缓存
heroku config:set NODE_MODULES_CACHE=false