部署到 heroku - 未能检测到 buildpack nodejs (jasonswett)

Posted

技术标签:

【中文标题】部署到 heroku - 未能检测到 buildpack nodejs (jasonswett)【英文标题】:Deploying to heroku - failed to detect buildpack nodejs (jasonswett) 【发布时间】:2017-01-19 02:35:22 【问题描述】:

我正在学习 Jason Swett 的“Angular for Rails 开发人员”一书中的教程。主题在第 2 章:部署。

首先我是这样做的:

$ rm -rf public
$ ln -s client/dist public

然后在 heroku 中创建应用程序后,我添加了 buildpacks

$ heroku buildpacks:add https://github.com/jasonswett/heroku-buildpack-nodejs
$ heroku buildpacks:add heroku/ruby

这是构建包的结果

=== author-wizard Buildpack URLs
1. https://github.com/jasonswett/heroku-buildpack-nodejs
2. heroku/ruby

这是 package.json 文件


      "name": "author-wizard",
      "version": "0.0.0",
      "license": "MIT",
      "angular-cli": ,
      "scripts": 
        "start": "ng server",
        "postinstall": "typings install && ng build",
        "lint": "tslint \"src/**/*.ts\"",
        "format": "clang-format -i -style=file --glob=src/**/*.ts",
        "pree2e": "webdriver-manager update",
        "e2e": "protractor"
      ,
      "private": true,
      "dependencies": 
        "@angular/common": "2.0.0-rc.1",
        "@angular/compiler": "2.0.0-rc.1",
        "@angular/core": "2.0.0-rc.1",
        "@angular/platform-browser": "2.0.0-rc.1",
        "@angular/platform-browser-dynamic": "2.0.0-rc.1",
        "@angular/router": "2.0.0-rc.1",
        "es6-shim": "^0.35.0",
        "reflect-metadata": "0.1.3",
        "rxjs": "5.0.0-beta.6",
        "systemjs": "0.19.26",
        "zone.js": "^0.6.12",
        "angular-cli": "0.0.*",
        "clang-format": "^1.0.35",
        "codelyzer": "0.0.14",
        "ember-cli-inject-live-reload": "^1.4.0",
        "jasmine-core": "^2.4.1",
        "jasmine-spec-reporter": "^2.4.0",
        "karma": "^0.13.15",
        "karma-chrome-launcher": "^0.2.3",
        "karma-jasmine": "^0.3.8",
        "protractor": "^3.3.0",
        "ts-node": "^0.5.5",
        "tslint": "^3.6.0",
        "typescript": "^1.8.10",
        "typings": "^0.8.1"
      ,
      "devDependencies": 

      
    

当我推送到heroku时:

$ gp heroku master
Counting objects: 54, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (47/47), done.
Writing objects: 100% (54/54), 11.31 KiB | 0 bytes/s, done.
Total 54 (delta 17), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Failed to detect set buildpack https://github.com/jasonswett/heroku-buildpack-nodejs
remote: More info: https://devcenter.heroku.com/articles/buildpacks#detection-failure
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to author-wizard.
remote:
To https://git.heroku.com/author-wizard.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/author-wizard.git'

如果有任何帮助,我将不胜感激。谢谢。

更新:

我在 rails root 中运行了 git push。这是 ls -la 的输出; ls -la 客户端:

$ ls -la; ls -la client
total 80
drwxr-xr-x  22 praburangki  staff   748 Sep 11 21:34 .
drwxr-xr-x  36 praburangki  staff  1224 Sep 11 20:27 ..
-rw-r--r--   1 praburangki  staff    43 Sep 11 21:39 .byebug_history
drwxr-xr-x  14 praburangki  staff   476 Sep 12 07:34 .git
-rw-r--r--   1 praburangki  staff   468 Sep 11 19:35 .gitignore
-rw-r--r--   1 praburangki  staff    30 Sep 11 21:09 .rspec
-rw-r--r--   1 praburangki  staff  1393 Sep 11 21:27 Gemfile
-rw-r--r--   1 praburangki  staff  4428 Sep 11 21:28 Gemfile.lock
-rw-r--r--   1 praburangki  staff   374 Sep 11 19:35 README.md
-rw-r--r--   1 praburangki  staff   227 Sep 11 19:35 Rakefile
drwxr-xr-x   9 praburangki  staff   306 Sep 11 21:13 app
drwxr-xr-x   8 praburangki  staff   272 Sep 11 19:36 bin
drwxr-xr-x  19 praburangki  staff   646 Sep 11 20:32 client
drwxr-xr-x  14 praburangki  staff   476 Sep 11 19:35 config
-rw-r--r--   1 praburangki  staff   130 Sep 11 19:35 config.ru
drwxr-xr-x   5 praburangki  staff   170 Sep 11 21:15 db
drwxr-xr-x   3 praburangki  staff   102 Sep 11 19:35 lib
drwxr-xr-x   5 praburangki  staff   170 Sep 11 21:16 log
lrwxr-xr-x   1 praburangki  staff    11 Sep 11 20:33 public -> client/dist
drwxr-xr-x   8 praburangki  staff   272 Sep 11 21:24 spec
drwxr-xr-x   7 praburangki  staff   238 Sep 11 19:40 tmp
drwxr-xr-x   2 praburangki  staff    68 Sep 11 19:35 vendor
total 64
drwxr-xr-x  19 praburangki  staff   646 Sep 11 20:32 .
drwxr-xr-x  22 praburangki  staff   748 Sep 11 21:34 ..
-rw-r--r--   1 praburangki  staff    73 Sep 11 20:07 .clang-format
-rw-r--r--   1 praburangki  staff   234 Sep 11 20:07 .editorconfig
drwxr-xr-x  12 praburangki  staff   408 Sep 11 22:20 .git
-rw-r--r--   1 praburangki  staff   335 Sep 11 20:07 .gitignore
-rw-r--r--   1 praburangki  staff   426 Sep 11 20:07 angular-cli-build.js
-rw-r--r--   1 praburangki  staff   415 Sep 11 20:07 angular-cli.json
drwxr-xr-x   8 praburangki  staff   272 Sep 11 20:07 config
drwxr-xr-x  12 praburangki  staff   408 Sep 11 20:28 dist
drwxr-xr-x   6 praburangki  staff   204 Sep 11 20:07 e2e
drwxr-xr-x  23 praburangki  staff   782 Sep 11 20:08 node_modules
-rw-r--r--   1 praburangki  staff  1251 Sep 11 22:16 package.json
drwxr-xr-x   3 praburangki  staff   102 Sep 11 20:32 public
drwxr-xr-x   9 praburangki  staff   306 Sep 11 20:07 src
drwxr-xr-x   3 praburangki  staff   102 Sep 11 20:32 tmp
-rw-r--r--   1 praburangki  staff  1685 Sep 11 20:07 tslint.json
drwxr-xr-x   6 praburangki  staff   204 Sep 11 20:09 typings
-rw-r--r--   1 praburangki  staff   352 Sep 11 20:07 typings.json

【问题讨论】:

两个问题:1)运行gp heroku master时,你在哪个文件夹?它是你的 Rails 根吗? (应该是。) 2)在你的 Rails 根目录下,你能分享这个命令的输出吗? ls -la;ls -la client @JasonSwett 更新了我的问题。是的,我在 rails 根文件夹中。 如果您尝试不使用这些说明会怎样? angularonrails.com/… 【参考方案1】:

试试这个

gp --force heroku master

希望在这里 gp 的意思是git push

【讨论】:

推送成功,构建失败。 远程:!推送失败?检查你的日志 啊,是的,对不起。我尝试使用 --force 但仍然没有运气。

以上是关于部署到 heroku - 未能检测到 buildpack nodejs (jasonswett)的主要内容,如果未能解决你的问题,请参考以下文章

部署streamlit工程到Heroku

由于警告,CMake 未能检测到 pthread

QML 未能检测到在 C++ 中破坏的 QObject

fscanf 未能检测到匹配失败。 libc 错误与否?

Visual Studio 2012 未能检测到 Visual Studio 2008 构建工具

未能将 Spring Boot 应用程序部署到 WildFly