Git Product home page Git Product logo

integer's Introduction

integer Build Status

Native 64-bit signed integers in Node.js.

  • All standard operators (arithmetic, bitwise, logical)
  • Protection from overflow and unsafe numbers
  • Always immutable
  • Other useful utilities

Installation

npm install --save integer

You must be using Node.js v10 or above. Prebuilt binaries are available for LTS versions + Linux/OSX.

Usage

var Integer = require('integer');

var a = Integer('7129837312139827189');
var b = a.subtract(1).shiftRight(3);
assert(b.equals('891229664017478398'));

Overflow protection

We will not let you perform operations that would result in overflow. If you try to create an Integer that cannot be represented in 64-bits (signed), we will throw a RangeError.

// These will each throw a RangeError
var tooBig = Integer(13897283129).multiply(13897283129);
var tooSmall = Integer.MIN_VALUE.subtract(1);
var divideByZero = Integer(123).divide(0);
var alsoTooBig = Integer('4029384203948203948923');

// You are also protected against two's complement overflow (this will throw a RangeError)
var twosComplement = Integer.MIN_VALUE.divide(-1);

Unsafe number protection

It's easy to convert between me and regular JavaScript numbers.

var int = Integer(12345);
assert(int instanceof Integer);

var num = Number(int); // same as int.toNumber()
assert(typeof num === 'number');

However, we will prevent you from converting an Integer to an unsafe number, and vice-versa. To learn more about unsafe numbers, click here.

// This will throw a RangeError
var unsafe = Integer(Number.MAX_SAFE_INTEGER + 1);

// This is okay
var int = Integer(Number.MAX_SAFE_INTEGER).plus(1);

// But this will throw a RangeError
var unsafe = int.toNumber();

API

Integer(value) -> Integer

Casts a value to an Integer. If the value cannot be converted safely and losslessly, a RangeError is thrown.

var a = Integer();
var b = Integer(12345);
var c = Integer('12345');
assert(a.equals(0));
assert(b.equals(c));

Integer.fromNumber(number, [defaultValue]) -> Integer

Casts a regular number to an Integer.

If the number is unsafe the defaultValue is used instead (or a RangeError is thrown if no defaultValue was provided).

Integer.fromNumber(12345, 0); // results in Integer(12345)
Integer.fromNumber(Number.MAX_SAFE_INTEGER + 1, 0); // results in Integer(0)

Integer.fromString(string, [radix, [defaultValue]]) -> Integer

Casts a string to an Integer. The string is assumed to be base-10 unless a different radix is specified.

If conversions fails the defaultValue is used instead (or a RangeError is thrown if no defaultValue was provided).

var hexColor = 'ff55dd';
var int = Integer.fromString(hexColor, 16, 'ffffff');

Integer.fromBits(lowBits, [highBits]) -> Integer

Creates an Integer by concatenating two regular 32-bit signed integers. The highBits are optional and default to 0.

var int = Integer.fromBits(0x40, 0x20);
int.toString(16); // => '2000000040'

Arithmetic operations

    .add/plus(other) -> Integer

    .subtract/sub/minus(other) -> Integer

    .multiply/mul/times(other) -> Integer

    .divide/div/divideBy/dividedBy/over(other) -> Integer

    .modulo/mod(other) -> Integer

Performs the arithmetic operation and returns a new Integer. The argument must either be a number, a base-10 string, or an Integer. If the operation results in overflow, a RangeError is thrown.

    .negate/neg() -> Integer

Returns the unary negation (-value) of the Integer.

    .abs/absoluteValue() -> Integer

Returns the absolute value of the Integer.

Bitwise operations

    .and(other) -> Integer

    .or(other) -> Integer

    .xor(other) -> Integer

    .not() -> Integer

Performs the bitwise operation and returns a new Integer. The argument must either be a number, a base-10 string, or an Integer.

    .shiftLeft/shl(numberOfBits) -> Integer

    .shiftRight/shr(numberOfBits) -> Integer

Shifts the Integer by specified number of bits and returns the result.

Logical operations

    .equals/eq/isEqualTo(other) -> boolean

    .notEquals/neq/isNotEqualTo/doesNotEqual(other) -> boolean

    .greaterThan/gt/isGreaterThan(other) -> boolean

    .lessThan/lt/isLessThan(other) -> boolean

    .greaterThanOrEquals/gte/isGreaterThanOrEqualTo(other) -> boolean

    .lessThanOrEquals/lte/isLessThanOrEqualTo(other) -> boolean

Performs the logical operation and returns true or false. The argument must either be a number, a base-10 string, or an Integer.

    .compare(other) -> number

Compares the value of the Integer and other, resulting in:

  • -1 if this is less than other
  • 1 if this is greater than other
  • 0 if this is equal to other

Converting to other values

    .toString([radix]) -> string

Converts the Integer to a string. A base-10 string is returned unless a different radix is specified.

    .valueOf/toNumber() -> number

Converts the Integer to a regular number. If the Integer is not within the safe range, a RangeError is thrown.

    .toNumberUnsafe() -> number

Converts the Integer to a regular number, even if the conversion would result in a loss of precision. This method will never throw an error.

Other utility

    .bitSizeAbs() -> number

Returns the number of bits necessary to hold the absolute value of the Integer.

Integer(0).bitSizeAbs(); // => 1
Integer(128).bitSizeAbs(); // => 8
Integer(-255).bitSizeAbs(); // => 8
Integer.fromString('4fffffffffff', 16).bitSizeAbs(); // => 47

    .isEven() -> boolean

    .isOdd() -> boolean

    .isPositive() -> boolean

    .isNegative() -> boolean

    .isZero() -> boolean

    .isNonZero/isNotZero() -> boolean

These methods are self-explanatory.

    .isSafe() -> boolean

    .isUnsafe() -> boolean

Returns whether or not the Integer is within the safe range. If it's not within the safe range, trying to convert it to a regular number would result in a RangeError being thrown.

The safe range is defined as n >= Number.MIN_SAFE_INTEGER && n <= Number.MAX_SAFE_INTEGER.

Integer.isInstance(value) -> boolean

Determines if the given value is an Integer object.

Getters

  • .low -> number - the lower 32-bits of the Integer
  • .high -> number - the upper 32-bits of the Integer

Constants

  • Integer.MAX_VALUE - maximum value of an Integer
  • Integer.MIN_VALUE - minimum value of an Integer
  • Integer.ZERO - an Integer with a value of 0
  • Integer.ONE - an Integer with a value of 1
  • Integer.NEG_ONE - an Integer with a value of -1

License

MIT

integer's People

Contributors

danielbarela avatar fprijate avatar jlongster avatar joshuawise avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

integer's Issues

TRACKER : error TRK0005: Failed to locate: "CL.exe".

D:\Project>npm install integer

[email protected] install D:\Project\node_modules\integer
node-gyp rebuild

D:\Project\node_modules\integer>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
TRACKER : error TRK0005: Failed to locate: "CL.exe". The system cannot find the file specified. [D:\Project\node_modules\integer\build\integer.vcxproj]

gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack at ChildProcess.emit (events.js:182:13)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:239:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd D:\Project\node_modules\integer
gyp ERR! node -v v10.9.0
gyp ERR! node-gyp -v v3.7.0
gyp ERR! not ok
npm WARN [email protected] No repository field.
npm WARN [email protected] license should be a valid SPDX license expression
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\Grant\AppData\Roaming\npm-cache_logs\2019-06-11T23_34_56_626Z-debug.log
2019-06-11T23_34_56_626Z-debug.log

Installation fails on Windows

Win7, x64

D:\app>npm i integer

> [email protected] install D:\app\node_modules\integer
> node-gyp rebuild


D:\app\node_modules\integer>if not defined npm_config_node_gyp (node "C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
gyp ERR! configure error
gyp ERR! stack Error: Can't find Python executable "C:\Users\user\.windows-build-tools\python27\python.exe", you can set the PYTHON env variable.
gyp ERR! stack     at PythonFinder.failNoPython (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:484:19)
gyp ERR! stack     at PythonFinder.<anonymous> (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:509:16)
gyp ERR! stack     at callback (C:\Users\user\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:289:20)
gyp ERR! stack     at FSReqWrap.oncomplete (fs.js:153:21)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\user\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\app\node_modules\integer
gyp ERR! node -v v10.16.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

node-gyp build fails on node 12.4

I guess the signature of node::addon_register_func has changed. Init in integer.cpp needs to take an extra void*. I can make it compile by adding void* dummy as a third param.

This happens on both linux and WSL. I'm confused though because runkit has Integer apparently working fine on 12.2

  CXX(target) Release/obj.target/integer/src/integer.o
../src/integer.cpp: In static member function 'static Result Integer::Cast(v8::Local<v8::String>, uint8_t)':
../src/integer.cpp:329:33: error: no matching function for call to 'v8::String::Value::Value(v8::Local<v8::String>&)'
   v8::String::Value utf16(string);
                                 ^
In file included from /root/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../src/integer.hpp:3,
                 from ../src/integer.cpp:1:
/root/.node-gyp/12.4.0/include/node/v8.h:3018:5: note: candidate: 'v8::String::Value::Value(v8::Isolate*, v8::Local<v8::Value>)'
     Value(Isolate* isolate, Local<v8::Value> obj);
     ^~~~~
/root/.node-gyp/12.4.0/include/node/v8.h:3018:5: note:   candidate expects 2 arguments, 1 provided
In file included from ../src/integer.hpp:3,
                 from ../src/integer.cpp:1:
../src/integer.cpp: At global scope:
/root/.node-gyp/12.4.0/include/node/node.h:556:43: warning: cast between incompatible function types from 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Object>)' to 'node::addon_register_func' {aka 'void (*)(v8::Local<v8::Object>, v8::Local<v8::Value>, void*)'} [-Wcast-function-type]
       (node::addon_register_func) (regfunc),                          \
                                           ^
/root/.node-gyp/12.4.0/include/node/node.h:590:3: note: in expansion of macro 'NODE_MODULE_X'
   NODE_MODULE_X(modname, regfunc, NULL, 0)  // NOLINT (readability/null_usage)
   ^~~~~~~~~~~~~
../src/integer.cpp:408:1: note: in expansion of macro 'NODE_MODULE'
 NODE_MODULE(integer, Integer::Init);
 ^~~~~~~~~~~
In file included from /root/.node-gyp/12.4.0/include/node/node.h:63,
                 from ../src/integer.hpp:3,
                 from ../src/integer.cpp:1:
/root/.node-gyp/12.4.0/include/node/v8.h: In instantiation of 'void v8::PersistentBase<T>::SetWeak(P*, typename v8::WeakCallbackInfo<P>::Callback, v8::WeakCallbackType) [with P = node::ObjectWrap; T = v8::Object; typename v8::WeakCallbackInfo<P>::Callback = void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)]':
/root/.node-gyp/12.4.0/include/node/node_object_wrap.h:84:78:   required from here
/root/.node-gyp/12.4.0/include/node/v8.h:9817:16: warning: cast between incompatible function types from 'v8::WeakCallbackInfo<node::ObjectWrap>::Callback' {aka 'void (*)(const v8::WeakCallbackInfo<node::ObjectWrap>&)'} to 'Callback' {aka 'void (*)(const v8::WeakCallbackInfo<void>&)'} [-Wcast-function-type]
                reinterpret_cast<Callback>(callback), type);
                ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
make: *** [integer.target.mk:110: Release/obj.target/integer/src/integer.o] Error 1

node-gyp rebuild failing

Hi there,

When attempting to install integer on macOS Catalina (10.15), it fails during the node-gyp rebuild process.

Whilst I would assume therefor that this is most likely an issue with node-gyp in macOS Catalina at this stage during to it being a beta OS, but was wondering if anyone here knows a solution to this or if pre-built binaries could be packaged instead so that node-gyp isn't required during installation.

npm i integer

> [email protected] install /Users/mattcowley/Downloads/test/node_modules/integer
> node-gyp rebuild

make: *** No rule to make target `../../../../../../../usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi', needed by `Makefile'.  Stop.
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:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Darwin 19.0.0
gyp ERR! command "/usr/local/Cellar/node/10.10.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/mattcowley/Downloads/test/node_modules/integer
gyp ERR! node -v v10.10.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/mattcowley/.npm/_logs/2019-06-16T13_25_50_492Z-debug.log

Problem with -0

The method Integer.fromBits does not accept javascript's minus zero the same way other methods do:

Integer(-0)
Integer { high: 0, low: 0 }
Integer.fromNumber(-0)
Integer { high: 0, low: 0 }
Integer.fromString('-0')
Integer { high: 0, low: 0 }
Integer.fromBits(0, -0)
TypeError: Expected second arguement to be a regular 32-bit signed integer

The problem might be caused by the word "arguement" :-)

And thanks a lot for the excellent module 'better-sqlite3'.

compilation error

Compiling with clang on win10 there is an error.

clang-cl : warning : argument unused during compilation: '/Gm-' [-Wunused-command-line-argument] [F:\TEST\fotoasistent\node
_modules\better-sqlite3\node_modules\integer\bui
ld\integer.vcxproj]
..\src\integer.cpp(389,35): error : in-class initializer for static data member is not a constant expression [F:\TEST\fotoa
sistent\node_modules\better-sqlite3\node_modules
\integer\build\integer.vcxproj]
static const int64_t MIN_VALUE = -0x8000000000000000LL;
^~~~~~~~~~~~~~~~~~~~~

Compiling with ms cl there is no error.

npm ERR! Failed at the [email protected] install script.

So I get the error npm ERR! Failed at the [email protected] install script. when installing quick.db. This happens to other packages rarely. This is not quick.db's fault though.

On Windows, this can be fixed with npm -g --add-python-to-path install windows-build-tools node-gyp, but since I'm on Ubuntu (VPS) I cannot. Does someone know the answer?

This is my debug:
2018-06-01T19_31_52_541Z-debug.log

Better-sqlite3 installation failed

`root@v1770:/home/jackal# npm install --save better-sqlite3

[email protected] install /home/node_modules/integer
prebuild-install || npm run build-release

prebuild-install WARN install No prebuilt binaries found (target=13.11.0 runtime=node arch=x64 libc= platform=linux)

[email protected] build-release /home/node_modules/integer
node-gyp rebuild --release

make: Entering directory '/home/node_modules/integer/build'
CXX(target) Release/obj.target/integer/src/integer.o
In file included from ../src/integer.hpp:3,
from ../src/integer.cpp:1:
/root/.cache/node-gyp/13.11.0/include/node/node.h:618:43: warning: cast between incompatible function types from ‘void ()(v8::Localv8::Object, v8::Localv8::Object)’ to ‘node::addon_register_func’ {aka ‘void ()(v8::Localv8::Object, v8::Localv8::Value, void*)’} [-Wcast-function-type]
618 | (node::addon_register_func) (regfunc),
| ^
/root/.cache/node-gyp/13.11.0/include/node/node.h:652:3: note: in expansion of macro ‘NODE_MODULE_X’
652 | NODE_MODULE_X(modname, regfunc, NULL, 0) // NOLINT (readability/null_usage)
| ^~~~~~~~~~~~~
../src/integer.cpp:408:1: note: in expansion of macro ‘NODE_MODULE’
408 | NODE_MODULE(integer, Integer::Init);
| ^~~~~~~~~~~
g++: fatal error: Killed signal terminated program cc1plus
compilation terminated.
make: *** [integer.target.mk:114: Release/obj.target/integer/src/integer.o] Error 1
make: Leaving directory '/home/node_modules/integer/build'
gyp ERR! build error
gyp ERR! stack Error: make failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:315:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Linux 5.3.0-24-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--release"
gyp ERR! cwd /home/node_modules/integer
gyp ERR! node -v v13.11.0
gyp ERR! node-gyp -v v5.0.7
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build-release: node-gyp rebuild --release
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] build-release script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-03-25T17_50_47_234Z-debug.log
npm WARN [email protected] requires a peer of better-sqlite3@^5.4.1 but none is installed. You must install peer dependencies yourself.
npm WARN home No description
npm WARN home No repository field.
npm WARN home No license field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: prebuild-install || npm run build-release
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-03-25T17_50_47_492Z-debug.log`

Can't install better-sqlite3

Unable to install integer

PS G:\Bot> npm i integer

[email protected] install G:\Bot\node_modules\integer
node-gyp rebuild

G:\Bot\node_modules\integer>if not defined npm_config_node_gyp (node "G:\Node.js files\node_modules\npm\node_modules\npm
-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "G:\Node.js files\node_modul
es\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\Win32\PlatformToolsets\v140\Toolset.targets(34,5): err
or MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK ve
rsion in the project property pages or by right-clicking the solution and selecting "Retarget solution". [G:\Bot\node_m
odules\integer\build\integer.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (G:\Node.js files\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack at emitTwo (events.js:126:13)
gyp ERR! stack at ChildProcess.emit (events.js:214:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.15063
gyp ERR! command "G:\Node.js files\node.exe" "G:\Node.js files\node_modules\npm\node_modules\node-gyp\bin\node-
gyp.js" "rebuild"
gyp ERR! cwd G:\Bot\node_modules\integer
gyp ERR! node -v v8.11.2
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN [email protected] requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencie
s yourself.
npm WARN [email protected] requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer de
pendencies yourself.
npm WARN [email protected] requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies
yourself.
npm WARN [email protected] requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencie
s yourself.
npm WARN [email protected] requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yo
urself.
npm WARN [email protected] requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dep
endencies yourself.
npm WARN [email protected] requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies your
self.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\vampy\AppData\Roaming\npm-cache_logs\2018-07-20T00_40_25_861Z-debug.log

So ... I'm not quite sure whats going wrong here but this is only happening when I try to intstall Integer. It's been happening for a few months now and no one knows how to help me ...

PS C:\windows\system32> npm -v
5.6.0
PS C:\windows\system32> node -v
v8.11.2

temp workaround to deploy issues:

Here is how I got integer to build. But this is short term, my project has downstream end users who will not be able to do this:

  1. remove all node, npm, yarn, packages, global packages.
    eg: /usr/local/share/.config/yarn/global/node_modules

  2. install nvm ( https://github.com/nvm-sh/nvm )
    eg:
    `
    append to ~/.zshrc:
    export NVM_DIR="$HOME/.nvm"
    [ -s "/usr/local/opt/nvm/nvm.sh" ] && . "/usr/local/opt/nvm/nvm.sh" # This loads nvm

[ -s "/usr/local/opt/nvm/etc/bash_completion" ] && . "/usr/local/opt/nvm/etc/bash_completion" # This loads nvm bash_completion
`
Install node via nvm

  1. install full xcode or similar dev tools
  2. install python (I think v2 works better )
  3. if mac: sudo xcode-select -s /Applications/Xcode.app/Contents/Developer
    Also yarn seems to work better than npm

Receiving compiler error c2144

Hi,

I am on Windows 10 64 bit. Ill printout some more details below. I am receiving a this compiler error: https://docs.microsoft.com/en-us/cpp/error-messages/compiler-errors-1/compiler-error-c2144 on these lines: https://github.com/JoshuaWise/integer/blob/master/src/integer.cpp#L392

Here is the build log

C:\Users\Mac\WebstormProjects\foobar>npm install better-sqlite3 --save
npm WARN lifecycle The node binary used for scripts is c:\program files (x86)\nodist\bin\node.exe but npm is using C:\Program Files (x86)\Nodist\v-x64\8.9.1\node.exe itself. Use the `
--scripts-prepend-node-path` option to include the path for the node binary npm was executed with.

> [email protected] install C:\Users\Mac\WebstormProjects\foobar\node_modules\integer
> node tools/install


C:\Users\Mac\WebstormProjects\foobar\node_modules\integer>if not defined npm_config_node_gyp (node "C:\Program Files (x86)\Nodist\npmv\5.5.1\bin\node-gyp-bin\\..\..\node_modules\node-
gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  integer.cpp
  win_delay_load_hook.cc
..\src\integer.cpp(392): error C2144: syntax error : 'double' should be preceded by ';' [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
..\src\integer.cpp(392): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\in
teger.vcxproj]
..\src\integer.cpp(393): error C2144: syntax error : 'double' should be preceded by ';' [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
..\src\integer.cpp(393): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\in
teger.vcxproj]
..\src\integer.cpp(393): error C2086: 'int Integer::constexpr' : redefinition [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
          ..\src\integer.cpp(392) : see declaration of 'Integer::constexpr'
..\src\integer.cpp(394): error C2146: syntax error : missing ';' before identifier 'uint64_t' [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
..\src\integer.cpp(394): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\in
teger.vcxproj]
..\src\integer.cpp(394): error C2086: 'int Integer::constexpr' : redefinition [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
          ..\src\integer.cpp(392) : see declaration of 'Integer::constexpr'
..\src\integer.cpp(395): error C2146: syntax error : missing ';' before identifier 'uint64_t' [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
..\src\integer.cpp(395): error C4430: missing type specifier - int assumed. Note: C++ does not support default-int [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\in
teger.vcxproj]
..\src\integer.cpp(395): error C2086: 'int Integer::constexpr' : redefinition [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
          ..\src\integer.cpp(392) : see declaration of 'Integer::constexpr'
..\src\integer.cpp(127): error C2597: illegal reference to non-static member 'Integer::U32_in_U64' [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
..\src\integer.cpp(127): error C3867: 'Integer::U32_in_U64': function call missing argument list; use '&Integer::U32_in_U64' to create a pointer to member [C:\Users\Mac\WebstormProje
cts\foobar\node_modules\integer\build\integer.vcxproj]
..\src\integer.cpp(127): error C2568: '&' : unable to resolve function overload [C:\Users\Mac\WebstormProjects\foobar\node_modules\integer\build\integer.vcxproj]
          unable to recover from previous error(s); stopping compilation
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\Nodist\npmv\5.5.1\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 10.0.16299
gyp ERR! command "C:\\Program Files (x86)\\Nodist\\v-x64\\8.9.1\\node.exe" "C:\\Program Files (x86)\\Nodist\\npmv\\5.5.1\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Mac\WebstormProjects\foobar\node_modules\integer
gyp ERR! node -v v8.9.1
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node tools/install`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Mac\AppData\Roaming\npm-cache\_logs\2018-01-22T19_11_19_892Z-debug.log

C:\Users\Mac\WebstormProjects\foobar>

Is there a workaround or anything I can change to get this working?

Thanks

Trouble installing

I'm trying out your better-sqlite3 package, but I'm not able to install it.

I've tracked it down to this dependency on the integer package. Whenever I npm install --save integer I get the following output (edited the node project path):

CXX(target) Release/obj.target/integer/src/integer.o
SOLINK_MODULE(target) Release/obj.target/integer.node
COPY Release/integer.node
cp: preserving permissions for ‘Release/integer.node’: Operation not permitted
integer.target.mk:133: recipe for target 'Release/integer.node' failed
make: *** [Release/integer.node] Error 1
make: Leaving directory '/[node_project_dir]/node_modules/integer/build'

I'm using Ubuntu 16.04 with Node v6.11.4 and NPM 3.10.10.

I already checked and installed node-gyp and build-essentials, so I think I have all the requirements accounted for.

Do you have any insight you could share?

Error when using "npm install"

Windows 10 Build 17763.253
Node v10.15.0
npm v6.4.1

PS C:\users\noxillio\documents\github\yum> npm i

> [email protected] install C:\users\noxillio\documents\github\yum\node_modules\integer
> node-gyp rebuild


C:\users\noxillio\documents\github\yum\node_modules\integer>if not defined npm_config_node_gyp (node "C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\bin\node-gyp.js" rebuild )
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
  integer.cpp
  win_delay_load_hook.cc
..\src\integer.cpp(370): warning C4804: '-': unsafe use of type 'bool' in operation [C:\users\noxillio\documents\github
\yum\node_modules\integer\build\integer.vcxproj]
C:\Users\Noxillio\.node-gyp\10.15.0\x64\node.lib : fatal error LNK1106: invalid file or disk full: cannot seek to 0x226
2F2 [C:\users\noxillio\documents\github\yum\node_modules\integer\build\integer.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:182:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:240:12)
gyp ERR! System Windows_NT 10.0.17763
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\users\noxillio\documents\github\yum\node_modules\integer
gyp ERR! node -v v10.15.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of sqlite@^2.8.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sequelize@^4.38.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of @discordjs/uws@^10.149.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of bufferutil@^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of zlib-sync@^0.1.4 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of better-sqlite-pool@github:eslachance/better-sqlite-pool but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\Noxillio\AppData\Roaming\npm-cache\_logs\2019-01-21T21_23_14_936Z-debug.log

dyld: lazy symbol binding failed: Symbol not found

After updating dependencies in my electron app I get this error when running yarn dev:

dyld: lazy symbol binding failed: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorE
  Referenced from: /Users/alexandergabriel/awel-personal/app/node_modules/integer/build/Release/integer.node
  Expected in: flat namespace

dyld: Symbol not found: __ZN2v816FunctionTemplate3NewEPNS_7IsolateEPFvRKNS_20FunctionCallbackInfoINS_5ValueEEEENS_5LocalIS4_EENSA_INS_9SignatureEEEiNS_19ConstructorBehaviorE
  Referenced from: /Users/alexandergabriel/awel-personal/app/node_modules/integer/build/Release/integer.node
  Expected in: flat namespace

Seems that integer is a dependency of better-sqlite3, this extract from the yarn.lock file:

[email protected]:
  version "5.3.0"
  resolved "https://registry.yarnpkg.com/better-sqlite3/-/better-sqlite3-5.3.0.tgz#64b5614582886eb5e6c2becfec03d9949f1e101a"
  integrity sha512-IZWjZsbS00Ys3DHeaB6WzJcJsC4SFiNP5p6doLhYfmZqGOEL84j/O2N/GjvsEmLJzTlYlBu7iVsv2CMbUPPfvg==
  dependencies:
    integer "^2.1.0"
    tar "^4.4.6"

So maybe this happens because I updated better-sqlite3 from v5.2.1 to v5.3.0

provide binaries to avoid build on install

It could be great if this module could provide binaries to avoid build on install, such as node-sass does.

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.9.3/linux-x64-57_binding.node
Download complete  ] - :
Binary saved to /home/user/dev/myproject/node_modules/node-sass/vendor/linux-x64-57/binding.node
Caching binary to /home/user/.npm/node-sass/4.9.3/linux-x64-57_binding.node

Most issues of integer are about difficulties to install it, this could solve this frequent problem.

Here are the binaries that should be provided:

  • Windows
  • Unix and Linux
  • macOS
  • Alpine Linux

For other architectures, there is still node-gyp.

Error installing the package on Azure

Have following error:

> npm install integer -dd
�[37;40mnpm info it worked if it ends with ok
�[37;40mnpm �[34;40mverb cli [ 'D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe',
�[37;40mnpm �[34;40mverb cli   'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\bin\\npm-cli.js',
�[37;40mnpm �[34;40mverb cli   'install',
�[37;40mnpm �[34;40mverb cli   'integer',
�[37;40mnpm �[34;40mverb cli   '-dd' ]
�[37;40mnpm info using [email protected]
�[37;40mnpm info using [email protected]
�[37;40mnpm �[34;40mverb npm-session 8016124db333a5c2
�[37;40mnpm �[32;40mhttp fetch GET 304 https://registry.npmjs.org/integer 283ms (from cache)
�[37;40mnpm �[34;40mverb correctMkdir D:\local\Temp\monacositeextension\temp\_locks correctMkdir not in flight; initializing
�[37;40mnpm �[34;40mverb lock using D:\local\Temp\monacositeextension\temp\_locks\staging-7ccd117e5dc1e199.lock for D:\home\site\wwwroot\node_modules\.staging
�[37;40mnpm info lifecycle [email protected]~preuninstall: [email protected]
�[37;40mnpm info lifecycle [email protected]~uninstall: [email protected]
�[37;40mnpm �[34;40mverb unbuild rmStuff [email protected] from D:\home\site\wwwroot\node_modules
�[37;40mnpm info lifecycle [email protected]~postuninstall: [email protected]
�[37;40mnpm info lifecycle [email protected]~preuninstall: [email protected]
�[37;40mnpm info lifecycle [email protected]~uninstall: [email protected]
�[37;40mnpm �[34;40mverb unbuild rmStuff [email protected] from D:\home\site\wwwroot\node_modules
�[37;40mnpm info lifecycle [email protected]~postuninstall: [email protected]
�[37;40mnpm info lifecycle [email protected]~preinstall: [email protected]
�[37;40mnpm info linkStuff [email protected]
�[37;40mnpm �[34;40mverb linkBins [email protected]
�[37;40mnpm �[34;40mverb linkMans [email protected]
�[37;40mnpm info lifecycle [email protected]~install: [email protected]
gyp info it worked if it ends with ok
gyp verb cli [ 'D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe',
gyp verb cli   'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild' ]
gyp info using [email protected]
gyp info using [email protected] | win32 | ia32
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed  python2 { Error: not found: python2
gyp verb `which` failed     at getNotFoundError (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:13:12)
gyp verb `which` failed     at F (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:68:19)
gyp verb `which` failed     at E (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:80:29)
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\which.js:89:16
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\index.js:42:5
gyp verb `which` failed     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\which\node_modules\isexe\windows.js:36:5
gyp verb `which` failed     at FSReqWrap.oncomplete (fs.js:152:21)
gyp verb `which` failed   stack: 'Error: not found: python2\n    at getNotFoundError (D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:13:12)\n    at F (D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:68:19)\n    at E (D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:80:29)\n    at D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\which.js:89:16\n    at D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\node_modules\\isexe\\index.js:42:5\n    at D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\which\\node_modules\\isexe\\windows.js:36:5\n    at FSReqWrap.oncomplete (fs.js:152:21)',
gyp verb `which` failed   code: 'ENOENT' }
gyp verb check python checking for Python executable "python" in the PATH
gyp verb `which` succeeded python D:\Python27\python.EXE

> [email protected] install D:\home\site\wwwroot\node_modules\integer
> node tools/install


D:\home\site\wwwroot\node_modules\integer>if not defined npm_config_node_gyp (node "D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild )  else (node "" rebuild ) 
gyp verb check python version `D:\Python27\python.EXE -c "import platform; print(platform.python_version());"` returned: "2.7.8\r\n"
gyp verb get node dir no --target version specified, falling back to host node version: 8.9.0
gyp verb command install [ '8.9.0' ]
gyp verb install input version string "8.9.0"
gyp verb install installing version: 8.9.0
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version is already installed, need to check "installVersion"
gyp verb got "installVersion" 9
gyp verb needs "installVersion" 9
gyp verb install version is good
gyp verb get node dir target node version installed: 8.9.0
gyp verb build dir attempting to create "build" dir: D:\home\site\wwwroot\node_modules\integer\build
gyp verb build dir "build" dir needed to be created? D:\home\site\wwwroot\node_modules\integer\build
gyp verb Not using VS2017: Could not use PowerShell to find VS2017
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: D:\home\site\wwwroot\node_modules\integer\build\config.gypi
gyp verb config.gypi checking for gypi file: D:\home\site\wwwroot\node_modules\integer\config.gypi
gyp verb common.gypi checking for gypi file: D:\home\site\wwwroot\node_modules\integer\common.gypi
gyp verb gyp gyp format was not specified; forcing "msvs"
gyp info spawn D:\Python27\python.EXE
gyp info spawn args [ 'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\gyp\\gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'msvs',
gyp info spawn args   '-G',
gyp info spawn args   'msvs_version=auto',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\home\\site\\wwwroot\\node_modules\\integer\\build\\config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   'D:\\local\\UserProfile\\.node-gyp\\8.9.0\\include\\node\\common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=D:\\local\\UserProfile\\.node-gyp\\8.9.0',
gyp info spawn args   '-Dnode_gyp_dir=D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp',
gyp info spawn args   '-Dnode_lib_file=D:\\local\\UserProfile\\.node-gyp\\8.9.0\\<(target_arch)\\node.lib',
gyp info spawn args   '-Dmodule_root_dir=D:\\home\\site\\wwwroot\\node_modules\\integer',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'D:\\home\\site\\wwwroot\\node_modules\\integer\\build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture ia32
gyp verb node dev dir D:\local\UserProfile\.node-gyp\8.9.0
gyp verb found first Solution file build/binding.sln
gyp verb could not find "msbuild.exe" in PATH - finding location in registry 
gyp info spawn D:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe
gyp info spawn args [ 'build/binding.sln',
gyp info spawn args   '/nologo',
gyp info spawn args   '/p:Configuration=Release;Platform=Win32' ]
gyp ERR! build error 
gyp ERR! stack Error: `D:\Program Files (x86)\MSBuild\14.0\bin\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\node-gyp\lib\build.js:258:23)
gyp ERR! stack     at emitTwo (events.js:126:13)
gyp ERR! stack     at ChildProcess.emit (events.js:214:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:198:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe" "D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd D:\home\site\wwwroot\node_modules\integer
gyp ERR! node -v v8.9.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok 
�[37;40mnpm �[34;40mverb lifecycle [email protected]~install: unsafe-perm in lifecycle true
�[37;40mnpm �[34;40mverb lifecycle [email protected]~install: PATH: D:\Program Files (x86)\npm\5.5.1\node_modules\npm\bin\node-gyp-bin;D:\home\site\wwwroot\node_modules\integer\node_modules\.bin;D:\home\site\wwwroot\node_modules\.bin;D:\Program Files (x86)\nodejs\8.9.0;D:\Program Files (x86)\Git\bin;D:\Program Files (x86)\nodejs\8.9.0;D:\Windows\system32;D:\Windows;D:\Windows\System32\Wbem;D:\Windows\System32\WindowsPowerShell\v1.0\;D:\Program Files (x86)\Git\cmd;D:\Program Files\Microsoft Network Monitor 3\;D:\Program Files (x86)\dotnet;D:\Program Files (x86)\PHP\v5.6;D:\Python27;
�[37;40mnpm �[34;40mverb lifecycle [email protected]~install: CWD: D:\home\site\wwwroot\node_modules\integer
�[37;40mnpm info lifecycle [email protected]~install: Failed to exec install script
�[37;40mnpm �[34;40mverb unlock done using D:\local\Temp\monacositeextension\temp\_locks\staging-7ccd117e5dc1e199.lock for D:\home\site\wwwroot\node_modules\.staging
Building the projects in this solution one at a time. To enable parallel build, please add the "/m" switch.
Build started 12/11/2017 6:11:30 PM.
Project "D:\home\site\wwwroot\node_modules\integer\build\binding.sln" on node 1 (default targets).
ValidateSolutionConfiguration:
  Building solution configuration "Release|Win32".
Project "D:\home\site\wwwroot\node_modules\integer\build\binding.sln" (1) is building "D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj" (2) on node 1 (default targets).
D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.
Done Building Project "D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj" (default targets) -- FAILED.
Done Building Project "D:\home\site\wwwroot\node_modules\integer\build\binding.sln" (default targets) -- FAILED.

Build FAILED.

"D:\home\site\wwwroot\node_modules\integer\build\binding.sln" (default target) (1) ->
"D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj" (default target) (2) ->
  D:\home\site\wwwroot\node_modules\integer\build\integer.vcxproj(20,3): error MSB4019: The imported project "D:\Microsoft.Cpp.Default.props" was not found. Confirm that the path in the <Import> declaration is correct, and that the file exists on disk.

    0 Warning(s)
    1 Error(s)

Time Elapsed 00:00:00.17
�[37;40mnpm �[34;40mverb stack Error: [email protected] install: `node tools/install`
�[37;40mnpm �[34;40mverb stack Exit status 1
�[37;40mnpm �[34;40mverb stack     at EventEmitter.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\npm-lifecycle\index.js:280:16)
�[37;40mnpm �[34;40mverb stack     at emitTwo (events.js:126:13)
�[37;40mnpm �[34;40mverb stack     at EventEmitter.emit (events.js:214:7)
�[37;40mnpm �[34;40mverb stack     at ChildProcess.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
�[37;40mnpm �[34;40mverb stack     at emitTwo (events.js:126:13)
�[37;40mnpm �[34;40mverb stack     at ChildProcess.emit (events.js:214:7)
�[37;40mnpm �[34;40mverb stack     at maybeClose (internal/child_process.js:925:16)
�[37;40mnpm �[34;40mverb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
�[37;40mnpm �[34;40mverb stack From previous event:
�[37;40mnpm �[34;40mverb stack     at runAction (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:74:13)
�[37;40mnpm �[34;40mverb stack     at actions.(anonymous function) (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:50:17)
�[37;40mnpm �[34;40mverb stack     at execAction (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:198:18)
�[37;40mnpm �[34;40mverb stack     at runCallback (timers.js:789:20)
�[37;40mnpm �[34;40mverb stack     at tryOnImmediate (timers.js:751:5)
�[37;40mnpm �[34;40mverb stack     at processImmediate [as _immediateCallback] (timers.js:722:5)
�[37;40mnpm �[34;40mverb stack From previous event:
�[37;40mnpm �[34;40mverb stack     at withInit (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:166:15)
�[37;40mnpm �[34;40mverb stack From previous event:
�[37;40mnpm �[34;40mverb stack     at withInit (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:182:13)
�[37;40mnpm �[34;40mverb stack     at runSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:165:10)
�[37;40mnpm �[34;40mverb stack     at doSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:146:3)
�[37;40mnpm �[34;40mverb stack     at Array.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
�[37;40mnpm �[34;40mverb stack     at LOOP (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
�[37;40mnpm �[34;40mverb stack     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:18:7
�[37;40mnpm �[34;40mverb stack     at doParallel (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:130:30)
�[37;40mnpm �[34;40mverb stack     at Array.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
�[37;40mnpm �[34;40mverb stack     at LOOP (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
�[37;40mnpm �[34;40mverb stack     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:18:7
�[37;40mnpm �[34;40mverb stack     at runSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:164:30)
�[37;40mnpm �[34;40mverb stack     at doSerial (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:146:3)
�[37;40mnpm �[34;40mverb stack     at Array.<anonymous> (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\bind-actor.js:15:8)
�[37;40mnpm �[34;40mverb stack     at LOOP (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:15:14)
�[37;40mnpm �[34;40mverb stack     at D:\Program Files (x86)\npm\5.5.1\node_modules\npm\node_modules\slide\lib\chain.js:18:7
�[37;40mnpm �[34;40mverb stack     at withInit.nodeify (D:\Program Files (x86)\npm\5.5.1\node_modules\npm\lib\install\actions.js:170:5)
�[37;40mnpm �[34;40mverb pkgid [email protected]
�[37;40mnpm �[34;40mverb cwd D:\home\site\wwwroot
�[37;40mnpm �[34;40mverb Windows_NT 6.2.9200
�[37;40mnpm �[34;40mverb argv "D:\\Program Files (x86)\\nodejs\\8.9.0\\node.exe" "D:\\Program Files (x86)\\npm\\5.5.1\\node_modules\\npm\\bin\\npm-cli.js" "install" "integer" "-dd"
�[37;40mnpm �[34;40mverb node v8.9.0
�[37;40mnpm �[34;40mverb npm  v5.5.1
�[37;40mnpm �[31;40mERR! code ELIFECYCLE
�[37;40mnpm �[31;40mERR! errno 1
�[37;40mnpm �[31;40mERR! [email protected] install: `node tools/install`
�[37;40mnpm �[31;40mERR! Exit status 1
�[37;40mnpm �[31;40mERR! 
�[37;40mnpm �[31;40mERR! Failed at the [email protected] install script.
�[37;40mnpm �[31;40mERR! This is probably not a problem with npm. There is likely additional logging output above.
�[37;40mnpm �[34;40mverb exit [ 1, true ]

�[37;40mnpm �[31;40mERR! A complete log of this run can be found in:
�[37;40mnpm �[31;40mERR!     D:\local\Temp\monacositeextension\temp\_logs\2017-12-11T18_11_32_508Z-debug.log

Log file attached. Related to WiseLibs/better-sqlite3#84

2017-12-11T18_11_32_508Z-debug.log

Error when install integer

The platform is macOS Catalina 10.15.2
node 13.6.0, npm 6.13.4

Here's the error code:
% npm install integer

[email protected] install /Users/xuezhang/cwc/cwc-integ/Sbgnviz-Collaborative-Editor/node_modules/better-sqlite3/node_modules/integer
node-gyp rebuild

CXX(target) Release/obj.target/integer/src/integer.o
../src/integer.cpp:329:21: error: no matching constructor for initialization of 'v8::String::Value'
v8::String::Value utf16(string);
^ ~~~~~~
/Users/xuezhang/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3210:5: note: candidate constructor not viable: no known
conversion from 'v8::Localv8::String' to 'const v8::String::Value' for 1st argument
Value(const Value&) = delete;
^
/Users/xuezhang/Library/Caches/node-gyp/13.6.0/include/node/v8.h:3203:5: note: candidate constructor not viable: requires 2
arguments, but 1 was provided
Value(Isolate* isolate, Localv8::Value obj);
^
1 error generated.
make: *** [Release/obj.target/integer/src/integer.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:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:321:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 19.2.0
gyp ERR! command "/usr/local/Cellar/node/13.6.0/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/xuezhang/cwc/cwc-integ/Sbgnviz-Collaborative-Editor/node_modules/better-sqlite3/node_modules/integer
gyp ERR! node -v v13.6.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: node-gyp rebuild
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /Users/xuezhang/.npm/_logs/2020-01-10T01_37_43_352Z-debug.log

Installation error - Cannot read property 'loaded' of undefined

I am with a error on the install of integer library.

The error is :

`
sh: 1: prebuild-install: Permission denied
Error: EACCES: permission denied, scandir '/root/test/node_modules/integer'
TypeError: Cannot read property 'get' of undefined
at errorMessage (/opt/node/lib/node_modules/npm/lib/utils/error-message.js:38:39)
at errorHandler (/opt/node/lib/node_modules/npm/lib/utils/error-handler.js:201:13)
at /opt/node/lib/node_modules/npm/bin/npm-cli.js:78:20
at cb (/opt/node/lib/node_modules/npm/lib/npm.js:225:22)
at /opt/node/lib/node_modules/npm/lib/npm.js:263:24
at /opt/node/lib/node_modules/npm/lib/config/core.js:81:7
at Array.forEach ()
at /opt/node/lib/node_modules/npm/lib/config/core.js:80:13
at f (/opt/node/lib/node_modules/npm/node_modules/once/once.js:25:25)
at /opt/node/lib/node_modules/npm/lib/config/core.js:110:20
TypeError: Cannot read property 'loaded' of undefined
at exit (/opt/node/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
at process.errorHandler (/opt/node/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at process.emit (events.js:311:20)
at processPromiseRejections (internal/process/promises.js:209:33)
at processTicksAndRejections (internal/process/task_queues.js:98:32)
/opt/node/lib/node_modules/npm/lib/utils/error-handler.js:97
var doExit = npm.config.loaded ? npm.config.get('_exit') : true
^

TypeError: Cannot read property 'loaded' of undefined
at exit (/opt/node/lib/node_modules/npm/lib/utils/error-handler.js:97:27)
at process.errorHandler (/opt/node/lib/node_modules/npm/lib/utils/error-handler.js:216:3)
at process.emit (events.js:311:20)
at process._fatalException (internal/process/execution.js:164:25)
npm WARN [email protected] No description
npm WARN [email protected] No repository field.

npm ERR! code ELIFECYCLE
npm ERR! errno 7
npm ERR! [email protected] install: prebuild-install || npm run build-release
npm ERR! Exit status 7
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-04-07T15_43_40_535Z-debug.log

`
To reproduce the error I created a Docker file

`
FROM ubuntu
RUN mkdir /root/test
WORKDIR /root/test
RUN apt-get update
RUN apt-get -y install xz-utils wget
RUN wget https://nodejs.org/dist/v12.16.1/node-v12.16.1-linux-x64.tar.xz
RUN tar xf node-v12.16.1-linux-x64.tar.xz
RUN mv node-v12.16.1-linux-x64 /opt/node
ENV PATH="/opt/node/bin:${PATH}"
RUN rm node-v12.16.1-linux-x64.tar.xz -rf
RUN npm i -g node-gyp@latest
RUN npm init -y
RUN cat package.json
RUN npm install integer --save

`

Run it with :

docker build .

to see the error.

On the docker file I already have the npm i -g node-gyp@latest command as suggested on another issues.

error: unrecognized command line option ‘-rdynamic’ while trying to build on Linux

Hello, I've been trying to build integer on Ubuntu 18.04.1, I installed GCC and renamed it and used the POSIX version, while trying to build it, I get this error.

dbr@raze:~/DBR$ npm install better-sqlite-pool

> [email protected] install /home/dbr/DBR/node_modules/integer
> node-gyp rebuild

make: Entering directory '/home/dbr/DBR/node_modules/integer/build'
  CXX(target) Release/obj.target/integer/src/integer.o
../src/integer.cpp: In static member function ‘static Result Integer::Cast(v8::Local<v8::String>, uint8_t)’:
../src/integer.cpp:329:33: warning: ‘v8::String::Value::Value(v8::Local<v8::Value>)’ is deprecated: Use Isolate version [-Wdeprecated-declarations]
   v8::String::Value utf16(string);
                                 ^
In file included from /home/dbr/.node-gyp/11.4.0/include/node/v8.h:26:0,
                 from /home/dbr/.node-gyp/11.4.0/include/node/node.h:63,
                 from ../src/integer.hpp:3,
                 from ../src/integer.cpp:1:
/home/dbr/.node-gyp/11.4.0/include/node/v8.h:3016:51: note: declared here
     V8_DEPRECATED("Use Isolate version", explicit Value(Local<v8::Value> obj));
                                                   ^
/home/dbr/.node-gyp/11.4.0/include/node/v8config.h:326:3: note: in definition of macro ‘V8_DEPRECATED’
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
  SOLINK_MODULE(target) Release/obj.target/integer.node
g++: error: unrecognized command line option ‘-rdynamic’
integer.target.mk:132: recipe for target 'Release/obj.target/integer.node' failed
make: *** [Release/obj.target/integer.node] Error 1
make: Leaving directory '/home/dbr/DBR/node_modules/integer/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:189:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:254:12)
gyp ERR! System Linux 4.15.0-20-generic
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/dbr/DBR/node_modules/integer
gyp ERR! node -v v11.4.0
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok
npm WARN [email protected] requires a peer of bufferutil@^3.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of erlpack@discordapp/erlpack but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of node-opus@^0.2.7 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of opusscript@^0.0.6 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of sodium@^2.0.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of libsodium-wrappers@^0.7.3 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of uws@^9.14.0 but none is installed. You must install peer dependencies yourself.
npm WARN [email protected] requires a peer of better-sqlite-pool@github:eslachance/better-sqlite-pool but none is installed. You must install peer dependencies yourself.

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/dbr/.npm/_logs/2018-12-15T07_25_20_581Z-debug.log

Here's the version of GCC used.

dbr@raze:~/DBR$ g++ --version
g++ (GCC) 7.3-posix 20180312
Copyright (C) 2017 Free Software Foundation, Inc.
This is free software; see the source for copying conditions.  There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.```

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.