Nodejs应用程序部署到Heroku失败

时间:2018-03-13 11:58:38

标签: node.js heroku heroku-cli

我一直在尝试将我的nodejs应用程序部署到heroku但我仍然坚持这个错误:

D:\Documents\Projects\Airflo>git push heroku master
Counting objects: 34, done.
Delta compression using up to 4 threads.
Compressing objects: 100% (27/27), done.
Writing objects: 100% (34/34), 1.96 MiB | 150.00 KiB/s, done.
Total 34 (delta 5), reused 0 (delta 0)
remote: Compressing source files... done.
remote: Building source:
remote:
remote: -----> Node.js app detected
remote:
remote: -----> Creating runtime environment
remote:
remote:        NPM_CONFIG_LOGLEVEL=error
remote:        NODE_VERBOSE=false
remote:        NODE_ENV=production
remote:        NODE_MODULES_CACHE=true
remote:
remote: -----> Installing binaries
remote:        engines.node (package.json):  8.10.0
remote:        engines.npm (package.json):   unspecified (use default)
remote:
remote:        Resolving node version 8.10.0...
remote:        Downloading and installing node 8.10.0...
remote:        Using default npm version: 5.6.0
remote:
remote: -----> Restoring cache
remote:        Skipping cache restore (not-found)
remote:
remote: -----> Building dependencies
remote:        Installing node modules (package.json + package-lock)
remote:
remote:        > contextify@0.1.15 install /tmp/build_93e52dc98e43695c7037e6ec63029a2f/node_modules/contextify
remote:        > node-gyp rebuild
remote:
remote:        make: Entering directory '/tmp/build_93e52dc98e43695c7037e6ec63029a2f/node_modules/contextify/build'
remote:        CXX(target) Release/obj.target/contextify/src/contextify.o
remote:        ../src/contextify.cc: In static member function ‘static v8::Local<v8::Context> ContextWrap::createV8Context(v8::Local<v8::Object>)’:
remote:        ../src/contextify.cc:131:68: warning: ‘v8::Local<v8::Object> v8::Function::NewInstance() const’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:        Local<Object> wrapper = Nan::New(constructor)->NewInstance();
remote:        ^
remote:        In file included from /app/.node-gyp/8.10.0/include/node/v8.h:26:0,
remote:        from /app/.node-gyp/8.10.0/include/node/node.h:63,
remote:        from ../src/contextify.cc:1:
remote:        /app/.node-gyp/8.10.0/include/node/v8.h:3851:52: note: declared here
remote:        V8_DEPRECATED("Use maybe version", Local<Object> NewInstance() const);
remote:        ^
remote:        /app/.node-gyp/8.10.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
remote:        declarator __attribute__((deprecated(message)))
remote:        ^
remote:        ../src/contextify.cc:150:16: error: ‘class v8::ObjectTemplate’ has no member named ‘SetAccessCheckCallbacks’
remote:        otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,
remote:        ^
remote:        ../src/contextify.cc: In static member function ‘static void ContextWrap::GlobalPropertyGetter(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Value>&)’:
remote:        ../src/contextify.cc:182:80: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:        Local<Value> rv = Nan::New(ctx->sandbox)->GetRealNamedProperty(property);
remote:        ^
remote:        In file included from /app/.node-gyp/8.10.0/include/node/v8.h:26:0,
remote:        from /app/.node-gyp/8.10.0/include/node/node.h:63,
remote:        from ../src/contextify.cc:1:
remote:        /app/.node-gyp/8.10.0/include/node/v8.h:3404:30: note: declared here
remote:        Local<Value> GetRealNamedProperty(Local<String> key));
remote:        ^
remote:        /app/.node-gyp/8.10.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
remote:        declarator __attribute__((deprecated(message)))
remote:        ^
remote:        ../src/contextify.cc: In static member function ‘static void ContextWrap::GlobalPropertyQuery(v8::Local<v8::String>, const Nan::PropertyCallbackInfo<v8::Integer>&)’:
remote:        ../src/contextify.cc:209:67: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:        if (!Nan::New(ctx->sandbox)->GetRealNamedProperty(property).IsEmpty() ||
remote:        ^
remote:        In file included from /app/.node-gyp/8.10.0/include/node/v8.h:26:0,
remote:        from /app/.node-gyp/8.10.0/include/node/node.h:63,
remote:        from ../src/contextify.cc:1:
remote:        /app/.node-gyp/8.10.0/include/node/v8.h:3404:30: note: declared here
remote:        Local<Value> GetRealNamedProperty(Local<String> key));
remote:        ^
remote:        /app/.node-gyp/8.10.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
remote:        declarator __attribute__((deprecated(message)))
remote:        ^
remote:        ../src/contextify.cc:210:71: warning: ‘v8::Local<v8::Value> v8::Object::GetRealNamedProperty(v8::Local<v8::String>)’ is deprecated: Use maybe version [-Wdeprecated-declarations]
remote:        !Nan::New(ctx->proxyGlobal)->GetRealNamedProperty(property).IsEmpty()) {
remote:        ^
remote:        In file included from /app/.node-gyp/8.10.0/include/node/v8.h:26:0,
remote:        from /app/.node-gyp/8.10.0/include/node/node.h:63,
remote:        from ../src/contextify.cc:1:
remote:        /app/.node-gyp/8.10.0/include/node/v8.h:3404:30: note: declared here
remote:        Local<Value> GetRealNamedProperty(Local<String> key));
remote:        ^
remote:        /app/.node-gyp/8.10.0/include/node/v8config.h:318:3: note: in definition of macro ‘V8_DEPRECATED’
remote:        declarator __attribute__((deprecated(message)))
remote:        ^
remote:        contextify.target.mk:95: recipe for target 'Release/obj.target/contextify/src/contextify.o' failed
remote:        make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
remote:        make: Leaving directory '/tmp/build_93e52dc98e43695c7037e6ec63029a2f/node_modules/contextify/build'
remote:        gyp ERR! build error
remote:        gyp ERR! stack Error: `make` failed with exit code: 2
remote:        gyp ERR! stack     at ChildProcess.onExit (/tmp/build_93e52dc98e43695c7037e6ec63029a2f/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:258:23)
remote:        gyp ERR! stack     at emitTwo (events.js:126:13)
remote:        gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
remote:        gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
remote:        gyp ERR! System Linux 4.4.0-1012-aws
remote:        gyp ERR! command "/tmp/build_93e52dc98e43695c7037e6ec63029a2f/.heroku/node/bin/node" "/tmp/build_93e52dc98e43695c7037e6ec63029a2f/.heroku/node/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
remote:        gyp ERR! cwd /tmp/build_93e52dc98e43695c7037e6ec63029a2f/node_modules/contextify
remote:        gyp ERR! node -v v8.10.0
remote:        gyp ERR! node-gyp -v v3.6.2
remote:        gyp ERR! not ok
remote:        npm ERR! code ELIFECYCLE
remote:        npm ERR! errno 1
remote:        npm ERR! contextify@0.1.15 install: `node-gyp rebuild`
remote:        npm ERR! Exit status 1
remote:        npm ERR!
remote:        npm ERR! Failed at the contextify@0.1.15 install script.
remote:        npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
remote:
remote:        npm ERR! A complete log of this run can be found in:
remote:        npm ERR!     /tmp/npmcache.odI4h/_logs/2018-03-13T11_47_03_138Z-debug.log
remote:
remote: -----> Build failed
remote:
remote:        We're sorry this build is failing! You can troubleshoot common issues here:
remote:        https://devcenter.heroku.com/articles/troubleshooting-node-deploys
remote:
remote:        If you're stuck, please submit a ticket so we can help:
remote:        https://help.heroku.com/
remote:
remote:        Love,
remote:        Heroku
remote:
remote:  !     Push rejected, failed to compile Node.js app.
remote:
remote:  !     Push failed
remote: Verifying deploy...
remote:
remote: !       Push rejected to airflo.
remote:
To https://git.heroku.com/airflo.git
 ! [remote rejected] master -> master (pre-receive hook declined)
error: failed to push some refs to 'https://git.heroku.com/airflo.git'

我的git设置正确。我还在package.json中添加了引擎,我使用节点v8.10.0 ...我还在gitignore中添加了node_modules,并在Procfile中告诉Heroku启动应用程序。

我不完全确定我在这里缺少什么。当我执行npm install时,contextify错误总是出现在我的开发环境中。但是当我运行应用程序时,上下文问题似乎没有任何问题,所以我认为这是一个例外。

任何帮助都会很棒;)

1 个答案:

答案 0 :(得分:0)

我之前有一个类似的问题部署到heroku,你可以通过Heroku CLI测试它吗:

  

heroku config:设置NODE_MODULES_CACHE = false --app app_name