Nodejs app deployment to Heroku fails
I've been trying to deploy my nodejs app to heroku but I'm stuck at this error:
D:DocumentsProjectsAirflo>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'
My git is setup correctly. I have also added the engine in package.json and I'm using node v8.10.0... I have also added node_modules in gitignore, and a Procfile to tell Heroku which to start the application.
I am not totally sure what I am missing here. The contextify error always appear in my dev environment when I perform npm install. But when I ran the application, the contextify issue does not seem to pose any problem so I think that is an exception.
Any help would be great ;)
I had a similar issue a while ago deploying to heroku, can you test this out via the Heroku CLI:
heroku config:set NODE_MODULES_CACHE=false --app app_name
链接地址: http://www.djcxy.com/p/85108.html