下面是两个软件包,我正在尝试将项目推送到heroku,控制台说npm和节点已安装在服务器上但是当我克隆项目时,项目中没有node_modules目录。 package.json中的'bower install'说找不到凉亭。当我删除“bower install”时,在推送时没有在服务器上安装依赖项,虽然控制台在安装时将它们写下来但是当我打开浏览器控制台时它们没有安装在服务器上。
的package.json:
{
"name": "meal-order",
"version": "0.0.0",
"description": "This is an app for ordering meal",
"main": "gulpfile.js",
"dependencies": {
"angular": "^1.5.5",
.....(other angular -libs)
"express": "^4.14.0",
"gulp": "^3.8.8",
"gulp-connect": "^3.0.9",
"ionicons": "^3.0.0",
"protractor": "^3.3.0"
},
"devDependencies": {
"bower": "1.7.7"
},
"engines": {
"node": "^5.11.1",
"npm": "^3.8.6"
},
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start": "node index.js",
"postinstall": "bower install"
},
bower.json:
"dependencies": {
"angular": "^1.5.5",
.....(other angular -libs)
"express": "^4.14.0",
"gulp": "^3.8.8",
"gulp-connect": "^3.0.9",
"ionicons": "^3.0.0",
"protractor": "^3.3.0"
},
"devDependencies": {},
"main": "gulpfile.js",
"license": "ISC",
"moduleType": [
"node"
],
的.gitignore:
/node_modules/*
node_modules/*
node_modules
npm-debug.log
这是我在控制台上遇到的错误:
remote: -----> Restoring cache
remote: Skipping cache restore (new runtime signature)
remote:
remote: -----> Building dependencies
remote: Installing node modules (package.json)
remote:
remote: > meal-order@0.0.0 postinstall /tmp/build_3ac183217c4c79ebe98cbb69eecb36de
remote: > bower install
remote:
remote: sh: 1: bower: not found
remote:
remote: npm ERR! Linux 3.13.0-91-generic
答案 0 :(得分:0)
如果要安装 devDependencies ,请在heroku的配置变量中添加以下内容。
key = NPM_CONFIG_PRODUCTION value = false
如果您使用命令行执行以下命令
heroku config:设置NPM_CONFIG_PRODUCTION = false
https://devcenter.heroku.com/articles/nodejs-support#devdependencies