首页 > 解决方案 > 如何解决,在heroku上推送应用程序时构建失败

问题描述

   npm ERR! code 1

   npm ERR! path /tmp/build_28367a71/node_modules/inotify
   npm ERR! command failed

   npm ERR! command sh -c node-gyp rebuild

npm 错误!make: 进入目录'/tmp/build_28367a71/node_modules/inotify/build'

   npm ERR!   CXX(target) Release/obj.target/inotify/src/bindings.o

   npm ERR! make: Leaving directory '/tmp/build_28367a71/node_modules/inotify/build'

   npm ERR! gyp info it worked if it ends with ok

   npm ERR! gyp info using node-gyp@7.1.2

   npm ERR! gyp info using node@16.2.0 | linux | x64

我遇到了这个问题,在heroku上推送了一个node js应用程序,请有人帮我解决它,我是编码新手。我使用节点版本 16.x

   ```npm ERR!  3976 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! ../src/bindings.cc:166:36: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>&)’

   npm ERR!   166 |    mask |= args_->Get(watch_for_sym)->Int32Value();

   npm ERR!       |                                    ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’

   npm ERR!  3973 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’

   npm ERR!  3976 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! ../src/bindings.cc:172:45: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>&)’

   npm ERR!   172 |   String::Utf8Value path(args_->Get(path_sym));

   npm ERR!       |                                             ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’

   npm ERR!  3973 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’

   npm ERR!  3976 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! ../src/bindings.cc:182:61: error: no matching function for call to ‘v8::Object::Get(v8::Local<v8::String>&)’

   npm ERR!   182 |   inotify->handle()->Set(descriptor, args_->Get(callback_sym));

   npm ERR!       |                                                             ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’

   npm ERR!  3973 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’

   npm ERR!  3976 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! ../src/bindings.cc: In static member function ‘static Nan::NAN_METHOD_RETURN_TYPE NodeInotify::Inotify::RemoveWatch(Nan::NAN_METHOD_ARGS_TYPE)’:

   npm ERR! ../src/bindings.cc:195:31: error: no matching function for call to ‘v8::Value::Int32Value()’

   npm ERR!   195 |   watch = info[0]->Int32Value();

   npm ERR!       |                               ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3078:40: note: candidate: ‘v8::Maybe<int> v8::Value::Int32Value(v8::Local<v8::Context>) const’

   npm ERR!  3078 |   V8_WARN_UNUSED_RESULT Maybe<int32_t> Int32Value(Local<Context> context) const;

   npm ERR!       |                                        ^~~~~~~~~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3078:40: note:   candidate expects 1 argument, 0 provided

   npm ERR! ../src/bindings.cc: In static member function ‘static void NodeInotify::Inotify::Callback(uv_poll_t*, int, int)’:

   npm ERR! ../src/bindings.cc:262:86: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’

   npm ERR!   262 |     obj->Set(Nan::New<String>("watch").ToLocalChecked(), Nan::New<Integer>(event->wd));

   npm ERR!       |                                                                                      ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’

   npm ERR!  3926 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’

   npm ERR!  3929 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! ../src/bindings.cc:263:87: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’

   npm ERR!   263 |     obj->Set(Nan::New<String>("mask").ToLocalChecked(), Nan::New<Integer>(event->mask));

   npm ERR!       |                                                                                       ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’

   npm ERR!  3926 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’

   npm ERR!  3929 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! ../src/bindings.cc:264:91: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, Nan::imp::IntegerFactory<v8::Integer>::return_t)’

   npm ERR!   264 |     obj->Set(Nan::New<String>("cookie").ToLocalChecked(), Nan::New<Integer>(event->cookie));

   npm ERR!       |                                                                                           ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’

   npm ERR!  3926 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’

   npm ERR!  3929 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! ../src/bindings.cc:267:104: error: no matching function for call to ‘v8::Object::Set(v8::Local<v8::String>, v8::Local<v8::String>)’

   npm ERR!   267 |      obj->Set(Nan::New<String>("name").ToLocalChecked(), Nan::New<String>(event->name).ToLocalChecked());

   npm ERR!       |                                                                                                        ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, v8::Local<v8::Value>, v8::Local<v8::Value>)’

   npm ERR!  3926 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3926:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note: candidate: ‘v8::Maybe<bool> v8::Object::Set(v8::Local<v8::Context>, uint32_t, v8::Local<v8::Value>)’

   npm ERR!  3929 |   V8_WARN_UNUSED_RESULT Maybe<bool> Set(Local<Context> context, uint32_t index,

   npm ERR!       |                                     ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3929:37: note:   candidate expects 3 arguments, 2 provided

   npm ERR! ../src/bindings.cc:275:66: error: no matching function for call to ‘v8::Object::Get(Nan::imp::IntegerFactory<v8::Integer>::return_t)’

   npm ERR!   275 |     Local<Value> value = handle->Get(Nan::New<Integer>(event->wd));

   npm ERR!       |                                                                  ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, v8::Local<v8::Value>)’

   npm ERR!  3973 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3973:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note: candidate: ‘v8::MaybeLocal<v8::Value> v8::Object::Get(v8::Local<v8::Context>, uint32_t)’

   npm ERR!  3976 |   V8_WARN_UNUSED_RESULT MaybeLocal<Value> Get(Local<Context> context,

   npm ERR!       |                                           ^~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3976:43: note:   candidate expects 2 arguments, 1 provided

   npm ERR! ../src/bindings.cc:279:34: warning: ‘v8::Local<v8::Value> Nan::Callback::Call(v8::Local<v8::Object>, int, v8::Local<v8::Value>*) const’ is deprecated [-Wdeprecated-declarations]

   npm ERR!   279 |     callback.Call(handle, 1, argv);

   npm ERR!       |                                  ^

   npm ERR! In file included from ../src/node_inotify.h:14,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! ../../nan/nan.h:1720:3: note: declared here

   npm ERR!  1720 |   Call(v8::Local<v8::Object> target

   npm ERR!       |   ^~~~

   npm ERR! ../src/bindings.cc:285:34: error: no matching function for call to ‘v8::Value::ToString()’

   npm ERR!   285 |      handle->Delete(wd->ToString());

   npm ERR!       |                                  ^

   npm ERR! In file included from /app/.cache/node-gyp/16.2.0/include/node/node.h:63,

   npm ERR!                  from ../src/node_inotify.h:5,

   npm ERR!                  from ../src/bindings.h:4,

   npm ERR!                  from ../src/bindings.cc:2:

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3019:44: note: candidate: ‘v8::MaybeLocal<v8::String> v8::Value::ToString(v8::Local<v8::Context>) const’

   npm ERR!  3019 |   V8_WARN_UNUSED_RESULT MaybeLocal<String> ToString(

   npm ERR!       |                                            ^~~~~~~~

   npm ERR! /app/.cache/node-gyp/16.2.0/include/node/v8.h:3019:44: note:   candidate expects 1 argument, 0 provided

   npm ERR! make: *** [inotify.target.mk:114: Release/obj.target/inotify/src/bindings.o] Error 1

   npm ERR! gyp ERR! build error 

   npm ERR! gyp ERR! stack Error: `make` failed with exit code: 2

   npm ERR! gyp ERR! stack     at ChildProcess.onExit (/tmp/build_28367a71/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)

   npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:365:28)

   npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)

   npm ERR! gyp ERR! System Linux 4.4.0-1088-aws

   npm ERR! gyp ERR! command "/tmp/build_28367a71/.heroku/node/bin/node" "/tmp/build_28367a71/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"

   npm ERR! gyp ERR! cwd /tmp/build_28367a71/node_modules/inotify

   npm ERR! gyp ERR! node -v v16.2.0

   npm ERR! gyp ERR! node-gyp -v v7.1.2

   npm ERR! gyp ERR! not ok

   

   npm ERR! A complete log of this run can be found in:

   npm ERR!     /tmp/npmcache.nFH3f/_logs/2021-06-06T18_08_52_077Z-debug.log

-----> 构建失败

   We're sorry this build is failing! You can troubleshoot common issues here:

   https://devcenter.heroku.com/articles/troubleshooting-node-deploys

   

   Some possible problems:

   

   - node_modules checked into source control

     https://devcenter.heroku.com/articles/node-best-practices#only-git-the-important-bits

   

   Love,

   Heroku

   

!推送被拒绝,无法编译 Node.js 应用程序。

!推送失败

标签: javascriptnode.jsheroku

解决方案


推荐阅读