我尝试使用最基本的 package.json 模板,但没有奏效。当我遇到这些类型的问题时,我什至不知道从哪里开始。
> node-gyp configure build
make: Entering directory `/tmp/build_2u2tdax6th79w/node_modules/bigint/build'
CXX(target) Release/obj.target/bigint/bigint.o
../bigint.cc:9:17: warning: gmp.h: No such file or directory
../bigint.cc:60: error: ISO C++ forbids declaration of 'mpz_t' with no type
../bigint.cc:60: error: expected ';' before '*' token
../bigint.cc:70: error: expected ')' before '*' token
../bigint.cc:110: error: expected initializer before '*' token
../bigint.cc: In constructor 'BigInt::BigInt(const v8::String::Utf8Value&, uint64_t)':
../bigint.cc:168: error: 'bigint_' was not declared in this scope
../bigint.cc:168: error: 'mpz_t' was not declared in this scope
../bigint.cc:168: error: expected primary-expression before ')' token
../bigint.cc:168: error: expected ';' before 'malloc'
../bigint.cc:169: error: 'mpz_init' was not declared in this scope
../bigint.cc:171: error: 'mpz_set_str' was not declared in this scope
../bigint.cc: In constructor 'BigInt::BigInt(uint64_t)':
../bigint.cc:176: error: 'bigint_' was not declared in this scope
../bigint.cc:176: error: 'mpz_t' was not declared in this scope
../bigint.cc:176: error: expected primary-expression before ')' token
../bigint.cc:176: error: expected ';' before 'malloc'
../bigint.cc:177: error: 'mpz_init' was not declared in this scope
../bigint.cc:179: error: 'mpz_set_ui' was not declared in this scope
../bigint.cc: In constructor 'BigInt::BigInt(int64_t)':
../bigint.cc:184: error: 'bigint_' was not declared in this scope
../bigint.cc:184: error: 'mpz_t' was not declared in this scope
../bigint.cc:184: error: expected primary-expression before ')' token
../bigint.cc:184: error: expected ';' before 'malloc'
../bigint.cc:185: error: 'mpz_init' was not declared in this scope
../bigint.cc:187: error: 'mpz_set_si' was not declared in this scope
../bigint.cc: At global scope:
../bigint.cc:190: error: expected ')' before '*' token
../bigint.cc: In constructor 'BigInt::BigInt()':
../bigint.cc:197: error: 'bigint_' was not declared in this scope
../bigint.cc:197: error: 'mpz_t' was not declared in this scope
../bigint.cc:197: error: expected primary-expression before ')' token
../bigint.cc:197: error: expected ';' before 'malloc'
../bigint.cc:198: error: 'mpz_init' was not declared in this scope
../bigint.cc:200: error: 'mpz_set_ui' was not declared in this scope
../bigint.cc: In destructor 'virtual BigInt::~BigInt()':
../bigint.cc:205: error: 'bigint_' was not declared in this scope
../bigint.cc:205: error: 'mpz_clear' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::New(const v8::Arguments&)':
../bigint.cc:227: error: 'mpz_t' was not declared in this scope
../bigint.cc:227: error: 'num' was not declared in this scope
../bigint.cc:227: error: expected primary-expression before ')' token
../bigint.cc:227: error: expected ';' before 'External'
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::ToString(const v8::Arguments&)':
../bigint.cc:269: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:269: error: 'mpz_get_str' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Badd(const v8::Arguments&)':
../bigint.cc:284: error: 'mpz_t' was not declared in this scope
../bigint.cc:284: error: 'res' was not declared in this scope
../bigint.cc:284: error: expected primary-expression before ')' token
../bigint.cc:284: error: expected ';' before 'malloc'
../bigint.cc:285: error: 'mpz_init' was not declared in this scope
../bigint.cc:287: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:287: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:287: error: 'mpz_add' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bsub(const v8::Arguments&)':
../bigint.cc:301: error: 'mpz_t' was not declared in this scope
../bigint.cc:301: error: 'res' was not declared in this scope
../bigint.cc:301: error: expected primary-expression before ')' token
../bigint.cc:301: error: expected ';' before 'malloc'
../bigint.cc:302: error: 'mpz_init' was not declared in this scope
../bigint.cc:303: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:303: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:303: error: 'mpz_sub' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bmul(const v8::Arguments&)':
../bigint.cc:317: error: 'mpz_t' was not declared in this scope
../bigint.cc:317: error: 'res' was not declared in this scope
../bigint.cc:317: error: expected primary-expression before ')' token
../bigint.cc:317: error: expected ';' before 'malloc'
../bigint.cc:318: error: 'mpz_init' was not declared in this scope
../bigint.cc:319: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:319: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:319: error: 'mpz_mul' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bdiv(const v8::Arguments&)':
../bigint.cc:333: error: 'mpz_t' was not declared in this scope
../bigint.cc:333: error: 'res' was not declared in this scope
../bigint.cc:333: error: expected primary-expression before ')' token
../bigint.cc:333: error: expected ';' before 'malloc'
../bigint.cc:334: error: 'mpz_init' was not declared in this scope
../bigint.cc:335: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:335: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:335: error: 'mpz_div' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Uadd(const v8::Arguments&)':
../bigint.cc:349: error: 'mpz_t' was not declared in this scope
../bigint.cc:349: error: 'res' was not declared in this scope
../bigint.cc:349: error: expected primary-expression before ')' token
../bigint.cc:349: error: expected ';' before 'malloc'
../bigint.cc:350: error: 'mpz_init' was not declared in this scope
../bigint.cc:351: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:351: error: 'mpz_add_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Usub(const v8::Arguments&)':
../bigint.cc:365: error: 'mpz_t' was not declared in this scope
../bigint.cc:365: error: 'res' was not declared in this scope
../bigint.cc:365: error: expected primary-expression before ')' token
../bigint.cc:365: error: expected ';' before 'malloc'
../bigint.cc:366: error: 'mpz_init' was not declared in this scope
../bigint.cc:367: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:367: error: 'mpz_sub_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Umul(const v8::Arguments&)':
../bigint.cc:381: error: 'mpz_t' was not declared in this scope
../bigint.cc:381: error: 'res' was not declared in this scope
../bigint.cc:381: error: expected primary-expression before ')' token
../bigint.cc:381: error: expected ';' before 'malloc'
../bigint.cc:382: error: 'mpz_init' was not declared in this scope
../bigint.cc:383: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:383: error: 'mpz_mul_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Udiv(const v8::Arguments&)':
../bigint.cc:397: error: 'mpz_t' was not declared in this scope
../bigint.cc:397: error: 'res' was not declared in this scope
../bigint.cc:397: error: expected primary-expression before ')' token
../bigint.cc:397: error: expected ';' before 'malloc'
../bigint.cc:398: error: 'mpz_init' was not declared in this scope
../bigint.cc:399: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:399: error: 'mpz_div_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Umul_2exp(const v8::Arguments&)':
../bigint.cc:413: error: 'mpz_t' was not declared in this scope
../bigint.cc:413: error: 'res' was not declared in this scope
../bigint.cc:413: error: expected primary-expression before ')' token
../bigint.cc:413: error: expected ';' before 'malloc'
../bigint.cc:414: error: 'mpz_init' was not declared in this scope
../bigint.cc:415: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:415: error: 'mpz_mul_2exp' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Udiv_2exp(const v8::Arguments&)':
../bigint.cc:429: error: 'mpz_t' was not declared in this scope
../bigint.cc:429: error: 'res' was not declared in this scope
../bigint.cc:429: error: expected primary-expression before ')' token
../bigint.cc:429: error: expected ';' before 'malloc'
../bigint.cc:430: error: 'mpz_init' was not declared in this scope
../bigint.cc:431: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:431: error: 'mpz_div_2exp' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Babs(const v8::Arguments&)':
../bigint.cc:444: error: 'mpz_t' was not declared in this scope
../bigint.cc:444: error: 'res' was not declared in this scope
../bigint.cc:444: error: expected primary-expression before ')' token
../bigint.cc:444: error: expected ';' before 'malloc'
../bigint.cc:445: error: 'mpz_init' was not declared in this scope
../bigint.cc:446: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:446: error: 'mpz_abs' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bneg(const v8::Arguments&)':
../bigint.cc:459: error: 'mpz_t' was not declared in this scope
../bigint.cc:459: error: 'res' was not declared in this scope
../bigint.cc:459: error: expected primary-expression before ')' token
../bigint.cc:459: error: expected ';' before 'malloc'
../bigint.cc:460: error: 'mpz_init' was not declared in this scope
../bigint.cc:461: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:461: error: 'mpz_neg' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bmod(const v8::Arguments&)':
../bigint.cc:475: error: 'mpz_t' was not declared in this scope
../bigint.cc:475: error: 'res' was not declared in this scope
../bigint.cc:475: error: expected primary-expression before ')' token
../bigint.cc:475: error: expected ';' before 'malloc'
../bigint.cc:476: error: 'mpz_init' was not declared in this scope
../bigint.cc:477: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:477: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:477: error: 'mpz_mod' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Umod(const v8::Arguments&)':
../bigint.cc:491: error: 'mpz_t' was not declared in this scope
../bigint.cc:491: error: 'res' was not declared in this scope
../bigint.cc:491: error: expected primary-expression before ')' token
../bigint.cc:491: error: expected ';' before 'malloc'
../bigint.cc:492: error: 'mpz_init' was not declared in this scope
../bigint.cc:493: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:493: error: 'mpz_mod_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bpowm(const v8::Arguments&)':
../bigint.cc:508: error: 'mpz_t' was not declared in this scope
../bigint.cc:508: error: 'res' was not declared in this scope
../bigint.cc:508: error: expected primary-expression before ')' token
../bigint.cc:508: error: expected ';' before 'malloc'
../bigint.cc:509: error: 'mpz_init' was not declared in this scope
../bigint.cc:510: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:510: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:510: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:510: error: 'mpz_powm' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Upowm(const v8::Arguments&)':
../bigint.cc:525: error: 'mpz_t' was not declared in this scope
../bigint.cc:525: error: 'res' was not declared in this scope
../bigint.cc:525: error: expected primary-expression before ')' token
../bigint.cc:525: error: expected ';' before 'malloc'
../bigint.cc:526: error: 'mpz_init' was not declared in this scope
../bigint.cc:527: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:527: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:527: error: 'mpz_powm_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Upow(const v8::Arguments&)':
../bigint.cc:541: error: 'mpz_t' was not declared in this scope
../bigint.cc:541: error: 'res' was not declared in this scope
../bigint.cc:541: error: expected primary-expression before ')' token
../bigint.cc:541: error: expected ';' before 'malloc'
../bigint.cc:542: error: 'mpz_init' was not declared in this scope
../bigint.cc:543: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:543: error: 'mpz_pow_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Uupow(const v8::Arguments&)':
../bigint.cc:561: error: 'mpz_t' was not declared in this scope
../bigint.cc:561: error: 'res' was not declared in this scope
../bigint.cc:561: error: expected primary-expression before ')' token
../bigint.cc:561: error: expected ';' before 'malloc'
../bigint.cc:562: error: 'mpz_init' was not declared in this scope
../bigint.cc:563: error: 'mpz_ui_pow_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Brand0(const v8::Arguments&)':
../bigint.cc:576: error: 'mpz_t' was not declared in this scope
../bigint.cc:576: error: 'res' was not declared in this scope
../bigint.cc:576: error: expected primary-expression before ')' token
../bigint.cc:576: error: expected ';' before 'malloc'
../bigint.cc:577: error: 'mpz_init' was not declared in this scope
../bigint.cc:579: error: 'randstate' was not declared in this scope
../bigint.cc:580: error: 'gmp_randstate_t' was not declared in this scope
../bigint.cc:580: error: expected primary-expression before ')' token
../bigint.cc:580: error: expected ';' before 'malloc'
../bigint.cc:581: error: 'gmp_randinit_default' was not declared in this scope
../bigint.cc:583: error: 'gmp_randseed_ui' was not declared in this scope
../bigint.cc:586: error: 'randstate' was not declared in this scope
../bigint.cc:586: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:586: error: 'mpz_urandomm' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Probprime(const v8::Arguments&)':
../bigint.cc:601: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:601: error: 'mpz_probab_prime_p' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Nextprime(const v8::Arguments&)':
../bigint.cc:610: error: 'mpz_t' was not declared in this scope
../bigint.cc:610: error: 'res' was not declared in this scope
../bigint.cc:610: error: expected primary-expression before ')' token
../bigint.cc:610: error: expected ';' before 'malloc'
../bigint.cc:611: error: 'mpz_init' was not declared in this scope
../bigint.cc:612: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:612: error: 'mpz_nextprime' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bcompare(const v8::Arguments&)':
../bigint.cc:627: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:627: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:627: error: 'mpz_cmp' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Scompare(const v8::Arguments&)':
../bigint.cc:638: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:638: error: 'mpz_cmp_si' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Ucompare(const v8::Arguments&)':
../bigint.cc:649: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:649: error: 'mpz_cmp_ui' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Band(const v8::Arguments&)':
../bigint.cc:659: error: 'mpz_t' was not declared in this scope
../bigint.cc:659: error: 'res' was not declared in this scope
../bigint.cc:659: error: expected primary-expression before ')' token
../bigint.cc:659: error: expected ';' before 'malloc'
../bigint.cc:660: error: 'mpz_init' was not declared in this scope
../bigint.cc:661: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:661: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:661: error: 'mpz_and' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bor(const v8::Arguments&)':
../bigint.cc:675: error: 'mpz_t' was not declared in this scope
../bigint.cc:675: error: 'res' was not declared in this scope
../bigint.cc:675: error: expected primary-expression before ')' token
../bigint.cc:675: error: expected ';' before 'malloc'
../bigint.cc:676: error: 'mpz_init' was not declared in this scope
../bigint.cc:677: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:677: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:677: error: 'mpz_ior' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bxor(const v8::Arguments&)':
../bigint.cc:691: error: 'mpz_t' was not declared in this scope
../bigint.cc:691: error: 'res' was not declared in this scope
../bigint.cc:691: error: expected primary-expression before ')' token
../bigint.cc:691: error: expected ';' before 'malloc'
../bigint.cc:692: error: 'mpz_init' was not declared in this scope
../bigint.cc:693: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:693: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:693: error: 'mpz_xor' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Binvertm(const v8::Arguments&)':
../bigint.cc:707: error: 'mpz_t' was not declared in this scope
../bigint.cc:707: error: 'res' was not declared in this scope
../bigint.cc:707: error: expected primary-expression before ')' token
../bigint.cc:707: error: expected ';' before 'malloc'
../bigint.cc:708: error: 'mpz_init' was not declared in this scope
../bigint.cc:709: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:709: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:709: error: 'mpz_invert' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bsqrt(const v8::Arguments&)':
../bigint.cc:722: error: 'mpz_t' was not declared in this scope
../bigint.cc:722: error: 'res' was not declared in this scope
../bigint.cc:722: error: expected primary-expression before ')' token
../bigint.cc:722: error: expected ';' before 'malloc'
../bigint.cc:723: error: 'mpz_init' was not declared in this scope
../bigint.cc:724: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:724: error: 'mpz_sqrt' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Broot(const v8::Arguments&)':
../bigint.cc:738: error: 'mpz_t' was not declared in this scope
../bigint.cc:738: error: 'res' was not declared in this scope
../bigint.cc:738: error: expected primary-expression before ')' token
../bigint.cc:738: error: expected ';' before 'malloc'
../bigint.cc:739: error: 'mpz_init' was not declared in this scope
../bigint.cc:740: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:740: error: 'mpz_root' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::BitLength(const v8::Arguments&)':
../bigint.cc:753: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:753: error: 'mpz_sizeinbase' was not declared in this scope
../bigint.cc: In static member function 'static v8::Handle<v8::Value> BigInt::Bgcd(const v8::Arguments&)':
../bigint.cc:767: error: 'mpz_t' was not declared in this scope
../bigint.cc:767: error: 'res' was not declared in this scope
../bigint.cc:767: error: expected primary-expression before ')' token
../bigint.cc:767: error: expected ';' before 'malloc'
../bigint.cc:768: error: 'mpz_init' was not declared in this scope
../bigint.cc:769: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:769: error: 'class BigInt' has no member named 'bigint_'
../bigint.cc:769: error: 'mpz_gcd' was not declared in this scope
make: *** [Release/obj.target/bigint/bigint.o] Error 1
make: Leaving directory `/tmp/build_2u2tdax6th79w/node_modules/bigint/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/tmp/node-npm-9JAw/node_modules/node-gyp/lib/build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Linux 3.8.11-ec2
gyp ERR! command "node" "/tmp/node-npm-9JAw/node_modules/node-gyp/bin/node-gyp.js" "configure" "build"
gyp ERR! cwd /tmp/build_2u2tdax6th79w/node_modules/bigint
gyp ERR! node -v v0.10.13
gyp ERR! node-gyp -v v0.10.0
gyp ERR! not ok
npm ERR! weird error 1
npm ERR! not ok code 0
! Failed to install --production dependencies with npm
! Push rejected, failed to compile Node.js app