Cant find node-gyp module

孤街醉人 提交于 2019-12-08 04:57:13

问题


So I have a project where I've been using node-gyp to port C++ to node.js. Everything's been working but when I used to run node-gyp build but I would get allot of warnings for doing things like using int when I should have been doing unsigned long int. So I did some cleanup and got rid of all the errors, but now when I run node test.js I get

MAC:project home$ node test.js

module.js:340
    throw err;
          ^
Error: Cannot find module 'build/Release/graph'
    at Function.Module._resolveFilename (module.js:338:15)
    at Function.Module._load (module.js:280:25)
    at Module.require (module.js:364:17)
    at require (module.js:380:17)
    at Object.<anonymous> (/Users/home/sutff/project/test.js:1:75)
    at Module._compile (module.js:456:26)
    at Object.Module._extensions..js (module.js:474:10)
    at Module.load (module.js:356:32)
    at Function.Module._load (module.js:312:12)
    at Function.Module.runMain (module.js:497:10)

and when I do node-gyp configure and node-gyp build I get

MAC:project home$ node-gyp configure
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.1
gyp info using node@0.10.21 | darwin | x64
gyp info spawn python
gyp info spawn args [ '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/home//sutff/project/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/home/.node-gyp/0.10.21/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/home/.node-gyp/0.10.21',
gyp info spawn args   '-Dmodule_root_dir=/Users/home//sutff/project',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp info ok
MAC:project home$ node-gyp build
gyp info it worked if it ends with ok
gyp info using node-gyp@0.12.1
gyp info using node@0.10.21 | darwin | x64
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CXX(target) Release/obj.target/graph/graph/addon.o
  CXX(target) Release/obj.target/graph/graph/directed_graph.o
  CXX(target) Release/obj.target/graph/graph/binding.o
  SOLINK_MODULE(target) Release/graph.node
  SOLINK_MODULE(target) Release/graph.node: Finished
gyp info ok

and all the test.js file includes is this

var Graph = require('build/Release/graph');

I don't understand how fixing errors, could change the location of the build file or why it would compile perfectly and then return this message. What am I doing wrong?

来源:https://stackoverflow.com/questions/20085231/cant-find-node-gyp-module

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!