javascript - 尽管在 package.json 和 Procfile 中进行了设置,Heroku 仍为 "npm ERR! missing script: start"

标签 javascript node.js heroku

我一直在谷歌上搜索尝试解决这个问题。我已将 package.json 修改为如下所示:

{
  "name": "webrtc-chat",
  "version": "1.0.0",
  "description": "Simple chat app using WebRTC",
  "main": "index.html",
  "scripts": {
   "start": "node server/server.js", 
   "test": "echo \"Error: no test specified\" && exit 1"
      },
  "author": "Sher Minn Chong",
  "license": "ISC",
  "devDependencies": {
    "grunt": "^0.4.5",
     "grunt-contrib-watch": "^0.6.1",
     "grunt-serve": "^0.1.6",
     "node-static": "^0.7.7"
  },
  "dependencies": {
   "node-static": "^0.7.7",
    "socket.io": "^1.3.6"
  }

}

和 Procfile:

web: node server/server.js

事实上,我在根服务器下的文件夹中有server.js。 当我更新脚本时,我尝试使用 git push -f heroku master ,然后使用 destroy 来完全删除项目,以防 git push 不够,然后创建,但问题仍然存在。

这是错误日志:

2017-04-01T12:32:10.000000+00:00 app[api]: Build succeeded
2017-04-01T12:32:26.119502+00:00 heroku[web.1]: Starting process with    command `npm start`
2017-04-01T12:32:28.800342+00:00 app[web.1]: npm ERR! argv   "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-04-01T12:32:28.799596+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-  generic
2017-04-01T12:32:28.803905+00:00 app[web.1]:
2017-04-01T12:32:28.800757+00:00 app[web.1]: npm ERR! node v6.10.1
2017-04-01T12:32:28.805587+00:00 app[web.1]: npm ERR!
2017-04-01T12:32:28.801137+00:00 app[web.1]: npm ERR! npm  v3.10.10
2017-04-01T12:32:28.805753+00:00 app[web.1]: npm ERR! If you need help,  you may report this error at:
2017-04-01T12:32:28.805256+00:00 app[web.1]: npm ERR! missing script: start
2017-04-01T12:32:28.805908+00:00 app[web.1]: npm ERR!         <https://github.com/npm/npm/issues>
2017-04-01T12:32:28.819004+00:00 app[web.1]:
2017-04-01T12:32:28.820190+00:00 app[web.1]: npm ERR! Please include the  following file with any support request:
2017-04-01T12:32:28.820468+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-04-01T12:32:28.881840+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-01T12:32:28.882904+00:00 heroku[web.1]: State changed from crashed to starting
2017-04-01T12:32:28.866923+00:00 heroku[web.1]: Process exited with status 1
2017-04-01T12:32:30.162305+00:00 heroku[web.1]: Starting process with command `npm start`
2017-04-01T12:32:32.696793+00:00 app[web.1]: npm ERR! Linux 3.13.0-112-generic
2017-04-01T12:32:32.697154+00:00 app[web.1]: npm ERR! argv "/app/.heroku/node/bin/node" "/app/.heroku/node/bin/npm" "start"
2017-04-01T12:32:32.697362+00:00 app[web.1]: npm ERR! node v6.10.1
2017-04-01T12:32:32.697582+00:00 app[web.1]: npm ERR! npm  v3.10.10
2017-04-01T12:32:32.699326+00:00 app[web.1]:
2017-04-01T12:32:32.700267+00:00 app[web.1]: npm ERR! missing script: start
2017-04-01T12:32:32.700411+00:00 app[web.1]: npm ERR!
2017-04-01T12:32:32.700481+00:00 app[web.1]: npm ERR! If you need help, you may report this error at:
2017-04-01T12:32:32.700576+00:00 app[web.1]: npm ERR!     <https://github.com/npm/npm/issues>
2017-04-01T12:32:32.709799+00:00 app[web.1]:
2017-04-01T12:32:32.710077+00:00 app[web.1]: npm ERR! Please include the following file with any support request:
2017-04-01T12:32:32.710137+00:00 app[web.1]: npm ERR!     /app/npm-debug.log
2017-04-01T12:32:32.792370+00:00 heroku[web.1]: Process exited with status 1
2017-04-01T12:32:32.811121+00:00 heroku[web.1]: State changed from starting to crashed
2017-04-01T12:32:33.779902+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/" host=apple-cake-55213.herokuapp.com   request_id=34c1dba4-31bc-4a6a-b421-de45d1660031 fwd="own IP removed" dyno= connect= service= status=503 bytes= protocol=https
2017-04-01T12:32:33.904512+00:00 heroku[router]: at=error code=H10 desc="App crashed" method=GET path="/favicon.ico" host=apple-cake- 55213.herokuapp.com request_id=8e9cf2d9-2109-49e3-826b-84139a0764e8 fwd="own  IP removed" dyno= connect= service= status=503 bytes= protocol=https

有什么想法吗?

谢谢!

最佳答案

我有同样的问题,认为是你的 package.json 文件的问题,我已在你的 package.json 文件中添加这些行,它会为我修复

"scripts": {
    "start": "node your-script.js"
 }

关于javascript - 尽管在 package.json 和 Procfile 中进行了设置,Heroku 仍为 "npm ERR! missing script: start",我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/43157048/

相关文章:

javascript - 在 Node 中读取 txt 文件时出现意外标识符

ruby-on-rails - Heroku Ruby 版本不会升级?

node.js - 使用环境变量中的 token 从私有(private) Github 存储库安装 NPM 包

javascript - 如何使用 Vuetify 网格在 v-for 循环中显示商店项目?

javascript - 如何从插槽中调用组件方法 - Vue

Javascript 正则表达式替换不在 html 属性中的文本

javascript - 将鼠标悬停在文本上以打开图像

node.js - Digital Ocean Dokku 无法选择构建包

javascript - 如何获取选择选项的值,并使用它来查询数组,以填充另一个输入

ruby-on-rails - Heroku Rails 无法通过 Bundler 安装 gems - 没有指定的来源