node-gyp: node-gyp build error

I get the following error every time I run my build, could someone advice what might be wrong and how to fix it?

My node versions

npm -v
4.2.0

node -v
v7.9.0
Error: /usr/local/Cellar/node/7.9.0/bin/node exited with code 1
Output:

> canvas@1.6.5 install /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/canvas
> node-gyp rebuild

  SOLINK_MODULE(target) Release/canvas-postbuild.node
  CXX(target) Release/obj.target/canvas/src/Canvas.o
  CXX(target) Release/obj.target/canvas/src/CanvasGradient.o
  CXX(target) Release/obj.target/canvas/src/CanvasPattern.o
  CXX(target) Release/obj.target/canvas/src/CanvasRenderingContext2d.o
  CXX(target) Release/obj.target/canvas/src/color.o
  CXX(target) Release/obj.target/canvas/src/Image.o
  CXX(target) Release/obj.target/canvas/src/ImageData.o
  CXX(target) Release/obj.target/canvas/src/init.o
  CXX(target) Release/obj.target/canvas/src/FontFace.o
  SOLINK_MODULE(target) Release/canvas.node

> contextify@0.1.15 install /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/contextify
> node-gyp rebuild

  CXX(target) Release/obj.target/contextify/src/contextify.o

Error output:
../src/contextify.cc:131:56: warning: 'NewInstance' is deprecated [-Wdeprecated-declarations]
        Local<Object> wrapper = Nan::New(constructor)->NewInstance();
                                                       ^
/Users/abisheksrikaanth/.electron-gyp/.node-gyp/iojs-1.6.8/deps/v8/include/v8.h:3648:52: note: 'NewInstance' has been explicitly marked deprecated here
  V8_DEPRECATED("Use maybe version", Local<Object> NewInstance() const);
                                                   ^
../src/contextify.cc:150:16: error: no member named 'SetAccessCheckCallbacks' in 'v8::ObjectTemplate'
        otmpl->SetAccessCheckCallbacks(GlobalPropertyNamedAccessCheck,
        ~~~~~  ^
../src/contextify.cc:182:51: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
        Local<Value> rv = Nan::New(ctx->sandbox)->GetRealNamedProperty(property);
                                                  ^
/Users/abisheksrikaanth/.electron-gyp/.node-gyp/iojs-1.6.8/deps/v8/include/v8.h:3220:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
                Local<Value> GetRealNamedProperty(Local<String> key));
                             ^
../src/contextify.cc:209:38: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
        if (!Nan::New(ctx->sandbox)->GetRealNamedProperty(property).IsEmpty() ||
                                     ^
/Users/abisheksrikaanth/.electron-gyp/.node-gyp/iojs-1.6.8/deps/v8/include/v8.h:3220:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
                Local<Value> GetRealNamedProperty(Local<String> key));
                             ^
../src/contextify.cc:210:42: warning: 'GetRealNamedProperty' is deprecated [-Wdeprecated-declarations]
            !Nan::New(ctx->proxyGlobal)->GetRealNamedProperty(property).IsEmpty()) {
                                         ^
/Users/abisheksrikaanth/.electron-gyp/.node-gyp/iojs-1.6.8/deps/v8/include/v8.h:3220:30: note: 'GetRealNamedProperty' has been explicitly marked deprecated here
                Local<Value> GetRealNamedProperty(Local<String> key));
                             ^
4 warnings and 1 error generated.
make: *** [Release/obj.target/contextify/src/contextify.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/local/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:106:13)
gyp ERR! stack     at ChildProcess.emit (events.js:194:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System Darwin 16.5.0
gyp ERR! command "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/contextify
gyp ERR! node -v v7.9.0
gyp ERR! node-gyp -v v3.5.0
gyp ERR! not ok

npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/lib/node_modules/npm/bin/npm-cli.js" "rebuild" "contextify" "canvas"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! contextify@0.1.15 install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the contextify@0.1.15 install script 'node-gyp rebuild'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the contextify package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-gyp rebuild
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs contextify
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls contextify
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/abisheksrikaanth/.npm/_logs/2017-05-02T05_50_00_625Z-debug.log

    at ChildProcess.childProcess.once.code (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder-util/src/util.ts:134:14)
    at Object.onceWrapper (events.js:293:19)
    at emitTwo (events.js:106:13)
    at ChildProcess.emit (events.js:194:7)
    at maybeClose (internal/child_process.js:899:16)
    at Socket.<anonymous> (internal/child_process.js:342:11)
    at emitOne (events.js:96:13)
    at Socket.emit (events.js:191:7)
    at Pipe._handle.close [as _onclose] (net.js:510:12)
From previous event:
    at spawn (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder-util/src/util.ts:97:3)
    at /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/src/yarn.ts:118:11
From previous event:
    at rebuild (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/yarn.js:87:22)
    at /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/src/yarn.ts:16:11
    at Generator.next (<anonymous>)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at installOrRebuild (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/yarn.js:33:21)
    at /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/src/packager.ts:305:13
    at Generator.next (<anonymous>)
From previous event:
    at Packager.installAppDependencies (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/packager.js:403:11)
    at /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/src/packager.ts:168:20
    at Generator.next (<anonymous>)
From previous event:
    at Packager.doBuild (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/packager.js:299:11)
    at /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/src/packager.ts:143:38
    at Generator.next (<anonymous>)
    at runCallback (timers.js:672:20)
    at tryOnImmediate (timers.js:645:5)
    at processImmediate [as _immediateCallback] (timers.js:617:5)
From previous event:
    at Packager.build (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/packager.js:251:11)
    at /Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/src/builder.ts:214:40
    at Generator.next (<anonymous>)
From previous event:
    at build (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/builder.js:63:21)
    at Object.<anonymous> (/Users/abisheksrikaanth/Viralstyle-Web-Projects/viralstyle+/node_modules/electron-builder/out/cli/build-cli.js:68:41)
    at Module._compile (module.js:571:32)
    at Object.Module._extensions..js (module.js:580:10)
    at Module.load (module.js:488:32)
    at tryModuleLoad (module.js:447:12)
    at Function.Module._load (module.js:439:3)
    at Module.runMain (module.js:605:10)
    at run (bootstrap_node.js:423:7)
    at startup (bootstrap_node.js:147:9)
    at bootstrap_node.js:538:3

npm ERR! Darwin 16.5.0
npm ERR! argv "/usr/local/Cellar/node/7.9.0/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v7.9.0
npm ERR! npm  v4.2.0
npm ERR! code ELIFECYCLE
npm ERR! errno 255
npm ERR! viralstyle-plus@0.0.0 build: `npm run pack && build`
npm ERR! Exit status 255
npm ERR!
npm ERR! Failed at the viralstyle-plus@0.0.0 build script 'npm run pack && build'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the viralstyle-plus package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run pack && build
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs viralstyle-plus
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls viralstyle-plus
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/abisheksrikaanth/.npm/_logs/2017-05-02T05_50_00_688Z-debug.lo

About this issue

  • Original URL
  • State: closed
  • Created 7 years ago
  • Comments: 19 (8 by maintainers)

Most upvoted comments

@sakshi094 This is a bug in npm@5 that it doesn’t respect optionalDependencies. contextify isn’t needed for recent versions of node. Try to run npm i --no-optional.

I am facing this issue when I try to run docker-compose up test on a release image. Screen Shot 2019-04-29 at 10 25 19 PM Please help! I have a project due and don’t what I am doing wrong.

Same issue here:

 yarn start
  yarn run v1.12.3
  $ ts-node ./src/engine/server/server
  Error: Cannot find module 'contextify'
     at Function.Module._resolveFilename (module.js:469:15)
     at Function.Module._load (module.js:417:25)
     at Module.require (module.js:497:17)
     at require (internal/module.js:20:19)
     at Object.<anonymous> 
  (/Users/aa/Documents/nodeApp/node_modules/jsdom/lib/jsdom/browser/index.js:5:21)
     at Module._compile (module.js:570:32)
     at Object.Module._extensions..js (module.js:579:10)
     at Module.load (module.js:487:32)
     at tryModuleLoad (module.js:446:12)
     at Function.Module._load (module.js:438:3)
  error Command failed with exit code 1.
  info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

Anybody?

The contextify readme says this: “YOU DON’T NEED THIS MODULE ON NODE >= 0.12”

As to the build error itself, .electron-gyp/.node-gyp/iojs-1.6.8 in the file paths suggests it’s picking up old headers. Remove the .electron-gyp directory and see what happens.