Code Monkey home page Code Monkey logo

farmhash's Introduction

farmhash

Node.js implementation of Google's FarmHash family of very fast hash functions.

FarmHash is the successor to CityHash. Functions in the FarmHash family are not suitable for cryptography. A fast, cryptographically-secure alternative is HighwayHash.

The 32-bit methods return a Number, the 64-bit methods return a BigInt and the 128-bit methods are not implemented.

This module uses FarmHash v1.1.0 (2015-03-01). It has been tested with Node.js 16, 18, 20 and 22 on Linux (glibc, musl), macOS (x64, arm64) and Windows (x86, x64).

Pre-compiled binaries are provided for Intel CPUs with SSE4.2 intrinsics and Apple ARM64 CPUs. Use the npm install --build-from-source flag to gain performance benefits on more modern CPUs such as those with AVX intrinsics.

Installation

npm install farmhash
yarn add farmhash
pnpm add farmhash

Usage

const farmhash = require('farmhash');
const hash = farmhash.hash32('test');
console.log(typeof hash); // 'number'
const hash = farmhash.hash64(new Buffer('test'));
console.log(typeof hash); // 'bigint'
const hash = farmhash.hash64WithSeed('test', 123);
console.log(typeof hash); // 'bigint'
const hash = farmhash.fingerprint32(new Buffer('test'));
console.log(typeof hash); // 'number'
const hash = farmhash.fingerprint64('test');
console.log(typeof hash); // 'bigint'
const hash = farmhash.fingerprint64signed('test');
console.log(typeof hash); // 'bigint'

API

Hash

The hash methods are platform dependent. Different CPU architectures, for example 32-bit vs 64-bit, Intel vs ARM, SSE4.2 vs AVX might produce different results for a given input.

hash32(input)

  • input is the Buffer or String to hash.

Returns a Number containing the 32-bit unsigned integer hash value of input.

hash32WithSeed(input, seed)

  • input is the Buffer or String to hash.
  • seed is an integer Number to use as a seed.

Returns a Number containing the 32-bit unsigned integer hash value of input.

hash64(input)

  • input is the Buffer or String to hash.

Returns a BigInt containing the 64-bit unsigned integer hash value of input.

hash64WithSeed(input, seed)

  • input is the Buffer or String to hash.
  • seed is an integer Number to use as a seed.

Returns a BigInt containing the 64-bit unsigned integer hash value of input.

hash64WithSeeds(input, seed1, seed2)

  • input is the Buffer or String to hash.
  • seed1 and seed2 are both an integer Number to use as seeds.

Returns a BigInt containing the 64-bit unsigned integer hash value of input.

Fingerprint

The fingerprint methods are platform independent, producing the same results for a given input on any machine.

fingerprint32(input)

  • input is the Buffer or String to fingerprint.

Returns a Number containing the 32-bit unsigned integer fingerprint value of input.

fingerprint64(input)

  • input is the Buffer or String to fingerprint.

Returns a BigInt containing the 64-bit unsigned integer fingerprint value of input.

fingerprint64signed(input)

  • input is the Buffer or String to fingerprint.

Returns a BigInt containing the 64-bit signed integer fingerprint value of input.

This matches the signed behaviour of Google BigQuery's FARM_FINGERPRINT function.

Testing

npm test

Licence

Copyright 2014 Lovell Fuller and contributors.

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at

 https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.

Copyright 2014, 2015, 2016, 2017 Google, Inc.

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

farmhash's People

Contributors

d3m3vilurr avatar evanlucas avatar ionizer avatar jhayes-dev avatar jhermsmeier avatar lovell avatar lpmi-13 avatar markyen avatar matt-esch avatar motiejus avatar mranney avatar nicknaso avatar tallguys avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

farmhash's Issues

farmhash should take an explicit dev dependency on node-gyp

In package.json, you can see that it runs node-gyp as part of the install script, but does nothing to ensure that the right version of it is being used.

I have a project where I tried to add farmhash indirectly through another module. farmhash failed to build with a node-gyp error, which I have redacted a bit below to hide directory names:

npm ERR! code 1
npm ERR! path /project/node_modules/farmhash
npm ERR! command failed
npm ERR! command sh -c prebuild-install || node-gyp rebuild
npm ERR! prebuild-install warn install No prebuilt binaries found (target=3 runtime=napi arch=arm64 libc= platform=darwin)
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using [email protected]
npm ERR! gyp info using [email protected] | darwin | arm64
npm ERR! gyp info find Python using Python version 3.12.3 found at "/opt/homebrew/opt/[email protected]/bin/python3.12"
npm ERR! gyp info spawn /opt/homebrew/opt/[email protected]/bin/python3.12
npm ERR! gyp info spawn args [
npm ERR! gyp info spawn args   '/project/node_modules/node-gyp/gyp/gyp_main.py',
npm ERR! gyp info spawn args   'binding.gyp',
npm ERR! gyp info spawn args   '-f',
npm ERR! gyp info spawn args   'make',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/project/node_modules/farmhash/build/config.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '/project/node_modules/node-gyp/addon.gypi',
npm ERR! gyp info spawn args   '-I',
npm ERR! gyp info spawn args   '$HOME/Library/Caches/node-gyp/20.12.2/include/node/common.gypi',
npm ERR! gyp info spawn args   '-Dlibrary=shared_library',
npm ERR! gyp info spawn args   '-Dvisibility=default',
npm ERR! gyp info spawn args   '-Dnode_root_dir=$HOME/Library/Caches/node-gyp/20.12.2',
npm ERR! gyp info spawn args   '-Dnode_gyp_dir=/project/node_modules/node-gyp',
npm ERR! gyp info spawn args   '-Dnode_lib_file=$HOME/Library/Caches/node-gyp/20.12.2/<(target_arch)/node.lib',
npm ERR! gyp info spawn args   '-Dmodule_root_dir=/project/node_modules/farmhash',
npm ERR! gyp info spawn args   '-Dnode_engine=v8',
npm ERR! gyp info spawn args   '--depth=.',
npm ERR! gyp info spawn args   '--no-parallel',
npm ERR! gyp info spawn args   '--generator-output',
npm ERR! gyp info spawn args   'build',
npm ERR! gyp info spawn args   '-Goutput_dir=.'
npm ERR! gyp info spawn args ]
npm ERR! Traceback (most recent call last):
npm ERR!   File "/project/node_modules/node-gyp/gyp/gyp_main.py", line 42, in <module>
npm ERR!     import gyp  # noqa: E402
npm ERR!     ^^^^^^^^^^
npm ERR!   File "/project/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 9, in <module>
npm ERR!     import gyp.input
npm ERR!   File "/project/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 19, in <module>
npm ERR!     from distutils.version import StrictVersion
npm ERR! ModuleNotFoundError: No module named 'distutils'
npm ERR! gyp ERR! configure error 
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (/project/node_modules/node-gyp/lib/configure.js:325:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:518:28)
npm ERR! gyp ERR! stack     at ChildProcess._handle.onexit (node:internal/child_process:294:12)
npm ERR! gyp ERR! System Darwin 23.4.0
npm ERR! gyp ERR! command "$HOME/.nvm/versions/node/v20.12.2/bin/node" "/project/node_modules/.bin/node-gyp" "rebuild"
npm ERR! gyp ERR! cwd /project/node_modules/farmhash
npm ERR! gyp ERR! node -v v20.12.2
npm ERR! gyp ERR! node-gyp -v v9.4.1
npm ERR! gyp ERR! not ok

The root problem here is that farmhash found an existing node-gyp version 9.4.1 that came from another module in the project (instead of finding the "default" one that comes with npm when installed globally).

This can be fixed if farmhash takes it own dev dependency on node-gyp 10.

trouble installing with npm: unrecognised compiler options (-Ofast and -flto)

Hi,

installing farmhash via NPM on uberspace (shared hoster) results in the following error message:

make: Entering directory `..../osmbc/node_modules/farmhash/build'
  CXX(target) Release/obj.target/farmhash/src/upstream/farmhash.o
cc1plus: Fehler: ungültiges Optionsargument »-Ofast«
cc1plus: Fehler: nicht erkannte Kommandozeilenoption »-flto«
make: *** [Release/obj.target/farmhash/src/upstream/farmhash.o] Fehler 1
make: Leaving directory `..../osmbc/node_modules/farmhash/build'

What can i do to avoid that ?

Christoph
P.S.
Fehler: ungültiges Optionsargument == Error: invalid option argument
Fehler: nicht erkannte Kommandozeilenoption == error: invalid command line option

[Error] Can't resolve ./build/debug/farmhash.node - Version 3.3.0

Hello,

I am running into the following bug when trying to use farmhash (version 3.3.0) in my project:

ERROR in ./node_modules/farmhash/index.js 7:11-49
Module not found: Error: Can't resolve './build/Debug/farmhash.node' in '.../node_modules/farmhash'
resolve './build/Debug/farmhash.node' in '.../node_modules/farmhash'
  using description file: .../node_modules/farmhash/package.json (relative path: .)
    using description file: .../node_modules/farmhash/package.json (relative path: ./build/Debug/farmhash.node)
      no extension
        .../node_modules/farmhash/build/Debug/farmhash.node doesn't exist
      .tsx
        .../node_modules/farmhash/build/Debug/farmhash.node.tsx doesn't exist
      .ts
        .../node_modules/farmhash/build/Debug/farmhash.node.ts doesn't exist
      .jsx
        .../node_modules/farmhash/build/Debug/farmhash.node.jsx doesn't exist
      .js
       .../node_modules/farmhash/build/Debug/farmhash.node.js doesn't exist
      .vue
        .../node_modules/farmhash/build/Debug/farmhash.node.vue doesn't exist
      as directory
       .../node_modules/farmhash/build/Debug/farmhash.node doesn't exist
webpack 5.76.0 compiled with 1 error in 20638 ms

The error is caused by this following code in index.js

const farmhash = (function farmhashBinding () {
  try {
    return require('./build/Release/farmhash.node');
  } catch (e) {
    return require('./build/Debug/farmhash.node');
  }
}());

because as you can see in the screenshot the referenced file does not exist
CleanShot 2023-06-01 at 11 31 45

I tried installing previous versions instead but then I ran into this issue and none of the solutions mentioned there worked for me.

Help will be highly appreciated, since we are really looking forward to using this package 😃

`Illegal instruction (core dumped)` on Alpine 3.8

Related to lovell/sharp-libvips#13 (by mistake, closing the other issue).

Was able to repro:

node -e "require('farmhash').hash32('sdflkjsdf')"

The most puzzling thing is why all the sudden this is happening.

Verified performing an npm rebuild farmhash resolved. Probably more of an issue from my end as to why different instruction sets are supported between the docker build environment and the release environment. But i'd at least like to better understand the exact difference and perhaps the pre-built could work around the issue?

Enhancement: provide prebuilt binaries for ARM64 macOS

After being forced to install the latest XCode on my mac, farmhash installation started failing in the gyp build step:

error /Users/munter/bucket/bucket-ingest/node_modules/farmhash: Command failed.
Exit code: 1
Command: prebuild-install || node-gyp rebuild
Arguments:
Directory: /Users/munter/bucket/bucket-ingest/node_modules/farmhash
Output:
prebuild-install WARN install No prebuilt binaries found (target=3 runtime=napi arch=arm64 libc= platform=darwin)
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | arm64
gyp info find Python using Python version 3.9.6 found at "/Applications/Xcode.app/Contents/Developer/usr/bin/python3"
(node:65594) [DEP0150] DeprecationWarning: Setting process.config is deprecated. In the future the property will be read-only.
(Use `node --trace-deprecation ...` to show where the warning was created)
gyp info spawn /Applications/Xcode.app/Contents/Developer/usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/Users/munter/.nvm/versions/node/v16.6.2/lib/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   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/munter/bucket/bucket-ingest/node_modules/farmhash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/munter/.nvm/versions/node/v16.6.2/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/Users/munter/Library/Caches/node-gyp/16.6.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/Users/munter/Library/Caches/node-gyp/16.6.2',
gyp info spawn args   '-Dnode_gyp_dir=/Users/munter/.nvm/versions/node/v16.6.2/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/Users/munter/Library/Caches/node-gyp/16.6.2/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/Users/munter/bucket/bucket-ingest/node_modules/farmhash',
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   'build',
gyp info spawn args   '-Goutput_dir=.'
gyp info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
  CC(target) Release/obj.target/nothing/../node-addon-api/nothing.o
  LIBTOOL-STATIC Release/nothing.a
env: python: No such file or directory
make: *** [Release/nothing.a] Error 127
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/Users/munter/.nvm/versions/node/v16.6.2/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:394:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Darwin 21.6.0
gyp ERR! command "/Users/munter/.nvm/versions/node/v16.6.2/bin/node" "/Users/munter/.nvm/versions/node/v16.6.2/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/munter/bucket/bucket-ingest/node_modules/farmhash

The same error happens if I use npm instead of yarn.

Recreated with farmhash versions 3.2.1 and 3.2.2.

unable to install

unable to install on my machine
CentOS release 6.2
node version v0.10.31
i have even tried on CentOS Linux release 7.0.1406 with node version v5.0.0

Typescript Type Definition

Hi there,

I was trying to use this package for Typescript but it's giving me an error saying that the type declaration (.d.ts) file doesn't exist.

Could not find a declaration file for module 'farmhash'. '.../node_modules/farmhash/index.js' implicitly has an 'any' type.
  Try `npm install @types/farmhash` if it exists or add a new declaration (.d.ts) file containing `declare module 'farmhash';`

Can we add the declaration file for this module?

I think I can help with a PR for this, or actually I'm not really sure if we should publish it to @types repo (and sadly I don't really know the conventions for this yet). If not, dts-gen package generates the following .d.ts file:

/** Declaration file generated by dts-gen */

export function fingerprint32(input: any): any;

export function fingerprint64(input: any): any;

export function hash32(input: any): any;

export function hash32WithSeed(input: any, seed: any): any;

export function hash64(input: any): any;

export function hash64WithSeed(input: any, seed: any): any;

export function hash64WithSeeds(input: any, seed1: any, seed2: any): any;

P.S.: Using dts-gen to generate the above file and putting it on my types directory works for Typescript projects. But I think it's still better if we don't need to use dts-gen 😁

fingerprint64 fails at runtime on node:10.15.3-alpine docker (Intel Xeon on AWS)

Hi,

Thanks for creating this awesome module.

This has been working nicely on Windows and Ubuntu local machines, but got an issue on Docker running on AWS.

Issue: At runtime, it fails when calling fingerprint64 function.

Environment details:

Docker Image: node:10.15.3-alpine
AWS Instance Type: GPU G3
Processor: Intel Xeon E5-2686 v4

farmhash version: 3.0.0

Does anyone have an idea on the root cause for this?

Crashes on heroku for hash of 8 characters or larger.

When running on a Heroku dyno, the farmhash prebuilt-install binary that gets downloaded crashes with an Illegal Instruction
it actually only happens when calling any Hash function for strings of 8 characters or longer.

It seems to be using:
[farmhash-v3.1.0-napi-v3-linux-x64.tar.gz]
(https://github.com/lovell/farmhash/releases/download/v3.1.0/farmhash-v3.1.0-napi-v3-linux-x64.tar.gz)

Running uname --kernel-name --kernel-release --machine gives me:
Linux 4.4.0-1078-aws x86_64

Node version : v12.18.4

proc/cpuinfo gives me:

processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 0
initial apicid : 0
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 1
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 1
cpu cores : 4
apicid : 2
initial apicid : 2
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 2
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 2
cpu cores : 4
apicid : 4
initial apicid : 4
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 3
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 4
apicid : 6
initial apicid : 6
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 4
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 0
cpu cores : 4
apicid : 1
initial apicid : 1
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 5
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 1
cpu cores : 4
apicid : 3
initial apicid : 3
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 6
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 2
cpu cores : 4
apicid : 5
initial apicid : 5
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

processor : 7
vendor_id : GenuineIntel
cpu family : 6
model : 62
model name : Intel(R) Xeon(R) CPU E5-2670 v2 @ 2.50GHz
stepping : 4
microcode : 0x42e
cpu MHz : 2494.102
cache size : 25600 KB
physical id : 0
siblings : 8
core id : 3
cpu cores : 4
apicid : 7
initial apicid : 7
fpu : yes
fpu_exception : yes
cpuid level : 13
wp : yes
flags : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ht syscall nx rdtscp lm constant_tsc rep_good nopl xtopology pni pclmulqdq ssse3 cx16 pcid sse4_1 sse4_2 x2apic popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm kaiser fsgsbase smep erms xsaveopt
bugs : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit
bogomips : 4988.20
clflush size : 64
cache_alignment : 64
address sizes : 46 bits physical, 48 bits virtual
power management:

farmhash fails to compile native extensions on a Raspberry Pi3

During an npm install on a Raspberry Pi3, Farmhash native extensions don't compile and the install fails. Interestingly, it works fine on a Raspberry Pi1.

Note that when compiling on an RPi1 and copying over to an RPi3, it works fine - it's just the actual compile that fails.

make: Entering directory '/home/bbs/enigma-bbs/node_modules/farmhash/build'
  CXX(target) Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o
*** Error in `g++': double free or corruption (top): 0x014a3c48 ***
farmhash-legacy.target.mk:103: recipe for target 'Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o' failed
make: *** [Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o] Aborted
make: Leaving directory '/home/bbs/enigma-bbs/node_modules/farmhash/build'

gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/home/bbs/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack     at emitTwo (events.js:87:13)
gyp ERR! stack     at ChildProcess.emit (events.js:172:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:200:12)
gyp ERR! System Linux 4.4.11-v7+
gyp ERR! command "/home/bbs/.nvm/versions/node/v4.4.7/bin/node" "/home/bbs/.nvm/versions/node/v4.4.7/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /home/bbs/enigma-bbs/node_modules/farmhash
gyp ERR! node -v v4.4.7
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok 
npm ERR! Linux 4.4.11-v7+
npm ERR! argv "/home/bbs/.nvm/versions/node/v4.4.7/bin/node" "/home/bbs/.nvm/versions/node/v4.4.7/bin/npm" "install"
npm ERR! node v4.4.7
npm ERR! npm  v2.15.8
npm ERR! code ELIFECYCLE

npm ERR! [email protected] install: `node-gyp rebuild`
npm ERR! Exit status 1

_Potentially Useful Info_
RPi3 (doesn't work):
node --version: v4.4.7
uname -a: Linux raspberrypi 4.4.11-v7+ #888 SMP Mon May 23 20:10:33 BST 2016 armv7l GNU/Linux
gcc --version: gcc (Raspbian 4.9.2-10) 4.9.2

RPi1 (does work):
uname -a: Linux raspberrypi 4.1.19+ #858 Tue Mar 15 15:52:03 GMT 2016 armv6l GNU/Linux
gcc --version: gcc (Raspbian 4.9.2-10) 4.9.2

N-API support

Node 8 has a new experimental feature called N-API which is aimed at reducing maintenance cost for node native addons. Check out this blog for more details on its benefits.

farmhash is a popular module, and in order to help the Node.js community make the important transition to N-API, we are hoping you will be able to work with us in order to migrate farmhash to N-API. Your support and feedback is important in making this effort a success.

We (N-API team) have built a preliminary port of farmhash on top of N-API as part of our effort to understand the API surface used by native modules. We used this port and the port of some other modules to determine which areas to focus on converting to N-API.
This port has all of the NAN code removed and replaced by N-API equivalents. While it passes all the unit tests, it might need a bit more refinement before getting merged in.
Please take a look if you're interested. I will be happy to answer questions about the port, point to documentation/code, etc. I'm also happy to open a PR if you're happy with the port in it's current shape.

If you like, you can join our WG meeting which happens every Thursday at 1:30 Eastern / 10:30 Pacific US time, to discuss any issues or ask us any questions.

If you don't want to take a dependency on a feature that still has "experimental" status, we understand, and a good option might be to maintain a branch that uses N-API, that is kept mostly up to date with development occurring in farmhash/master. We have some precedence to follow with node.bcrypt.js which recently published a N-API version of their module. Of course we'd appreciate feedback about anything we can do to improve the development or migration experience.

You can find my work here: https://github.com/NickNaso/farmhash/tree/napi

I will be happy to contribute and help in any way.

browserify farmhash failed with unexpected char

I try to browserify winnow.js,
But I get error:

I know that farmhash.node have node extension, browserify will failed with .node extension,
I try use browserify -t transform, but not sure how to use it to make it accept .node extension.

Another try is to use webpack, setup loader as node, will accept .node extension, I have not try yet,

Do you think why and what cause the trouble?
Webpack can success?
Browserify can success?
How?

              `/Users/nicole/node/winnow/node_modules/farmhash/build/Release/farmhash.node:1
    ����
      0���__TEXT�__text__TEXT�
                       �m�
                          �__stubs__TEXT�y       ��__stub_helper__TEXT�z��z�__const__TEXT�|%�|__cstring__TEXT�}8�}__gcc_except_tab__TEXT��__unwind_info__TEXT�8�__eh_frame__TEXTX��
             X��__DATA��__nl_symbol_ptr__DATA��0__got__DATA��2__la_symbol_ptr__DATA(��(�5__mod_init_func__DATA���	__data__DATA�����H__LINKEDIT�t�t"�0�  �Pp��`h�8�94�@
        P6��e�꤫�1=��X
                    ��$
       ^
          ParseError: Unexpected character '�'`

Aws Lambda can't have this package

Hi, I'm aiden.

I'm currently having a trouble building a serverless node server(AWS Lambda).
The errors are like this below.

`yarn run v1.22.22
$ nest build --webpack
ERROR in ./node_modules/farmhash/build/Release/farmhash.node 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
@ ./node_modules/farmhash/index.js 5:11-51
@ ./node_modules/firebase-admin/lib/remote-config/condition-evaluator-internal.js 21:17-36
@ ./node_modules/firebase-admin/lib/remote-config/remote-config.js 22:39-80
@ ./node_modules/firebase-admin/lib/app/firebase-namespace.js 219:29-83
@ ./node_modules/firebase-admin/lib/default-namespace.js 19:29-64
@ ./node_modules/firebase-admin/lib/index.js 19:17-47
@ ./src/sms/sms.service.ts 33:12-37
@ ./src/sms/sms.module.ts 40:22-46
@ ./src/app.module.ts 19:21-48
@ ./src/lambda.ts 34:21-44

ERROR in ./node_modules/farmhash/index.js 7:11-49
Module not found: Error: Can't resolve './build/Debug/farmhash.node' in '/home/runner/work/backend_v1/backend_v1/node_modules/farmhash'
resolve './build/Debug/farmhash.node' in '/home/runner/work/backend_v1/backend_v1/node_modules/farmhash'
using description file: /home/runner/work/backend_v1/backend_v1/node_modules/farmhash/package.json (relative path: .)
using description file: /home/runner/work/backend_v1/backend_v1/node_modules/farmhash/package.json (relative path: ./build/Debug/farmhash.node)
no extension
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node doesn't exist
.tsx
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node.tsx doesn't exist
.ts
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node.ts doesn't exist
.js
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node.js doesn't exist
as directory
/home/runner/work/backend_v1/backend_v1/node_modules/farmhash/build/Debug/farmhash.node doesn't exist
@ ./node_modules/firebase-admin/lib/remote-config/condition-evaluator-internal.js 21:17-36
@ ./node_modules/firebase-admin/lib/remote-config/remote-config.js 22:39-80
@ ./node_modules/firebase-admin/lib/app/firebase-namespace.js 219:29-83
@ ./node_modules/firebase-admin/lib/default-namespace.js 19:29-64
@ ./node_modules/firebase-admin/lib/index.js 19:17-47
@ ./src/sms/sms.service.ts 33:12-37
@ ./src/sms/sms.module.ts 40:22-46
@ ./src/app.module.ts 19:21-48
@ ./src/lambda.ts 34:21-44

webpack 5.90.1 compiled with 2 errors in 68925 ms
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
Error: Process completed with exit code 1.
##[debug]Finishing: Run yarn build:serverless`

The errors started since I added "firebase-admin" package into the system.
But the firebase-admin doesn't use this 'farmhash' package directly.
It should be one of the firebase-admin's 3rd party packages.

I guess Lambda can't handle this type of expression. (using . relative path)
return require('./build/Release/farmhash.node'); } catch (e) { return require('./build/Debug/farmhash.node');

Do you know how to solve this issue?
I can't move on and update the system because of this.
Please help me out if you have time.

Thank you.

SIGILL with latest farmhash

After updating to the latest 2.0.1 version, farmhash crashes for me in CentOS x64.

Details of system:

  • OS: CentOS 7 x64
  • Kernel: Linux 3.10.0-514.16.1.el7.x86_64
  • Node.js version: 6.11.3

Small program that crashes (index.js):

console.log('before require');
const farmhash = require('farmhash');
function main() {
        console.log('before string');
        const art = 'abc'.repeat(1000);
        console.log('before hash');
        const hash = farmhash.hash32(art);
        console.log(hash);
}
main();

The above outputs:

node index.js
before require
before string
before hash
fish: “node index.js” terminated by signal SIGILL (Illegal instruction)

I tried this with a previous dot version of Node with the same results. The same code functions on my eOS (Ubuntu) x64 machine. Previous versions of farmhash worked on both.

install fails on node v12.3.1

build fails on v12.3.1

node-gyp: v3.8.0
node: v12.3.1
npm: 6.9.0

/Edit
This can be fixed when updating the nan dependency to 2.14.0

                                                  ^
/root/.node-gyp/12.3.1/include/node/v8config.h:307:3: note: in definition of macro 'V8_DEPRECATED'
   declarator __attribute__((deprecated(message)))
   ^~~~~~~~~~
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:223,
                 from ../src/bindings.cc:16:
../../nan/nan_implementation_12_inl.h: In static member function 'static Nan::imp::FactoryBase<v8::StringObject>::return_t Nan::imp::Factory<v8::StringObject>::New(v8::Local<v8::String>)':
../../nan/nan_implementation_12_inl.h:356:37: error: no matching function for call to 'v8::StringObject::New(v8::Local<v8::String>&)'
   return v8::StringObject::New(value).As<v8::StringObject>();
                                     ^
In file included from /root/.node-gyp/12.3.1/include/node/node.h:63:0,
                 from ../src/bindings.cc:15:
/root/.node-gyp/12.3.1/include/node/v8.h:5380:23: note: candidate: static v8::Local<v8::Value> v8::StringObject::New(v8::Isolate*, v8::Local<v8::String>)
   static Local<Value> New(Isolate* isolate, Local<String> value);
                       ^~~
/root/.node-gyp/12.3.1/include/node/v8.h:5380:23: note:   candidate expects 2 arguments, 1 provided
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:223,
                 from ../src/bindings.cc:16:
In file included from ../../nan/nan_new.h:189:0,
                 from ../../nan/nan.h:223,
                 from ../src/bindings.cc:16:
../../nan/nan_implementation_12_inl.h:356:58: error: expected primary-expression before '>' token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                          ^
../../nan/nan_implementation_12_inl.h:356:60: error: expected primary-expression before ')' token
   return v8::StringObject::New(value).As<v8::StringObject>();
                                                            ^
In file included from /usr/include/c++/7/cassert:44:0,
                 from /root/.node-gyp/12.3.1/include/node/node_object_wrap.h:26,
                 from ../../nan/nan.h:55,
                 from ../src/bindings.cc:16:
../../nan/nan_object_wrap.h: In destructor 'virtual Nan::ObjectWrap::~ObjectWrap()':
../../nan/nan_object_wrap.h:24:25: error: 'class Nan::Persistent<v8::Object>' has no member named 'IsNearDeath'
     assert(persistent().IsNearDeath());
                         ^
../../nan/nan_object_wrap.h: In static member function 'static void Nan::ObjectWrap::WeakCallback(const v8::WeakCallbackInfo<Nan::ObjectWrap>&)':
../../nan/nan_object_wrap.h:127:26: error: 'class Nan::Persistent<v8::Object>' has no member named 'IsNearDeath'
     assert(wrap->handle_.IsNearDeath());
                          ^
farmhash.target.mk:120: recipe for target 'Release/obj.target/farmhash/src/bindings.o' failed
make: *** [Release/obj.target/farmhash/src/bindings.o] Error 1
make: Leaving directory '/mystuff/node_modules/farmhash/build'

gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/root/.nvm/versions/node/v12.3.1/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/lib/build.js:262:23)
gyp ERR! stack     at ChildProcess.emit (events.js:200:13)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.15.0-45-generic
gyp ERR! command "/root/.nvm/versions/node/v12.3.1/bin/node" "/root/.nvm/versions/node/v12.3.1/lib/node_modules/npm/node_modules/npm-lifecycle/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /mystuff/node_modules/farmhash
gyp ERR! node -v v12.3.1
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok

Specify Pre-Compiled Binaries At Install Time

Hi,

I am installing farmhash in an Ubuntu environment and deploying to an Azure Functions Windows environment. Is there a way to specify the precompiled binary to use so that Windows is the targeted platform? If so, what would the command be for this?

Right now deploying to Azure I get the following:

FailureException: Worker was unable to load function azureLogIngestion: 'Error: \\?\C:\home\site\wwwroot\node_modules\farmhash\build\Release\farmhash.node is not a valid Win32 application

Thanks!

Enhancement: prebuilt binaries for linux-arm64 and linuxmusl-arm64

Future possible enhancement to provide prebuilt binaries for Linux (glibc and musl) running on ARM64.

CircleCI can be used for this purpose e.g. https://github.com/lovell/sharp/blob/main/.circleci/config.yml


I don't have any immediate plans to work on this particular task so if anyone requires this urgently then I am available for paid consulting. Anyone wishing to support open source software development by purchasing 1 day of my time to work on this task is very welcome to do so via https://buy.stripe.com/6oE00r1Qe7sgeli6oR - thanks in advance.

Build fails on arm64 alpine:3.8 gcc 8.2.0

Installing farmhash on an arm64 machine inside a Ubuntu docker image works fine.

prebuild-install WARN install No prebuilt binaries found (target=8.10.0 runtime=node arch=arm64 platform=linux)
make: Entering directory '/app/node_modules/farmhash/build'
  CXX(target) Release/obj.target/farmhash/src/upstream/farmhash.o
  CXX(target) Release/obj.target/farmhash/src/bindings.o
  SOLINK_MODULE(target) Release/obj.target/farmhash.node
  COPY Release/farmhash.node
make: Leaving directory '/app/node_modules/farmhash/build'

However, attempting to install it in an Alpine image (Alpine 3.8 with gcc 8.2.0) fails:

prebuild-install WARN install No prebuilt binaries found (target=10.14.1 runtime=node arch=arm64 platform=linux)
make: Entering directory '/app/node_modules/farmhash/build'
  CXX(target) Release/obj.target/farmhash/src/upstream/farmhash.o
cc1plus: error: unknown value 'armv8-\xd0\x1b88' for -march
cc1plus: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a native; did you mean 'armv8-a'?
make: *** [farmhash.target.mk:112: Release/obj.target/farmhash/src/upstream/farmhash.o] Error 1
make: Leaving directory '/app/node_modules/farmhash/build'

Attempting to override -march with CFLAGS and CXXFLAGS:

prebuild-install WARN install No prebuilt binaries found (target=10.14.1 runtime=node arch=arm64 platform=linux)
make: Entering directory '/app/node_modules/farmhash/build'
  CXX(target) Release/obj.target/farmhash/src/upstream/farmhash.o
cc1plus: error: unknown value 'armv8-a-march=armv8-a' for -march
cc1plus: note: valid arguments are: armv8-a armv8.1-a armv8.2-a armv8.3-a armv8.4-a native
make: *** [farmhash.target.mk:112: Release/obj.target/farmhash/src/upstream/farmhash.o] Error 1
make: Leaving directory '/app/node_modules/farmhash/build'

It appears to ignore the values provided and concocts its own bizarre string armv8-a-march=armv8-a which seems strange. It's almost as if it's ignoring the CFLAGS and CXXFLAGS.

Does anyone have any ideas?

fingerprint64 results inconsistent with Google BigQuery

Google BigQuery has farm_fingerprint 64 as a built in function. https://cloud.google.com/bigquery/docs/reference/standard-sql/functions-and-operators#farm_fingerprint

BiqQuery:

SELECT FARM_FINGERPRINT("1footrue");

Returns -1541654101129638711

lovell/farmhash:

farmhash.fingerprint64("1footrue")

yields 16905089972579912905

Shouldn't they produce the same? For any string that BQ produces a positive hash for i.e. "2applefalse" both this package and bigquery converge on 2794438866806483259.

fingerprint64 doesn't match java implementation

Howdy,

I'm trying to use this library to match a same hash function using google common hash implemented in java, but I can't seem to get the same results on either platform.

Here's the java implementation:

import com.google.common.hash.HashFunction;
import com.google.common.hash.Hasher;
import com.google.common.hash.Hashing;

HashFunction hf = Hashing.farmHashFingerprint64();
Hasher hasher = hf.newHasher().putBytes("foo".getBytes());

Assert.assertEquals("e383932f606f5c55", hasher.hash().toString());

Here's a node implementation:

import * as farmhash from 'farmhash'

const result = farmhash.fingerprint64(Buffer.from('foo'));

expect(Number(result).toString(16)).toBe('555c6f602f938400');

Why does the node result not match the java result?

Error: /User/node_modules/farmhash/build/Release/farmhash.node: invalid ELF header

I am following this script node-cluster-socket and getting this error

Error: /User/node_modules/farmhash/build/Release/farmhash.node: invalid ELF header
    at Object.Module._extensions..node (module.js:678:18)
    at Module.load (module.js:561:32)
    at tryModuleLoad (module.js:501:12)
    at Function.Module._load (module.js:493:3)
    at Module.require (module.js:593:17)
    at require (internal/module.js:11:18)
    at Object.<anonymous> (/User/node_modules/farmhash/index.js:3:18)
    at Module._compile (module.js:649:30)
    at Module._extensions..js (module.js:660:10)
    at Object.require.extensions.(anonymous function) [as .js] (/User/node_modules/babel-register/lib/node.js:152:7)

application running in docker container as

docker run                  \
    --rm                    \
    --name=xxxx-quiz       \
    --env "APP_HOST=localhost" \
    --env "APP_PORT=8086" \
    --network=xxxx   \
    -v ${PWD}:/xxxx \
    -w "/quiz"  \
    -p 8086:8086            \
    node:9.8.0 \
    npm run dev

i even tried to build the container with Dockerfile and then run, however getting the same error

fingerprint32 function not working in ubuntu

Version system:

> lsb_release -a
Distributor ID:  Ubuntu
Description:      Ubuntu 20.04.1 LTS
Release:            20.04
Codename:       focal

The file test.js is:

const farmHash = require("farmhash");

const a = farmHash.fingerprint32("rs121909217");

console.log(a);

package.json contains the following dependency:

"farmhash": "^3.2.1"

When I execute node test.js on windows I get no trouble, and it prints 3935480791. However, when I execute it in ubuntu I get the following error:

Illegal instruction (core dumped)

[question] Is Node 8 unsupported in v3.0.0?

From what I can tell by looking at the commits, removing support for Node 8 was an afterthought when releasing [email protected]. I'm migrating a library to Node 12 and don't want to necessarily drop support for v8. If I yarn install --ignore-engines with Node 8 and farmhash 3, everything builds fine. I just wanted to see why support for Node 8 was dropped other than it leaving active LTS status. It's still in maintenance LTS at the moment, so it'd be great to allow, if possible

hash64 generate different value as other language implements

similar #27
hash32/64 families generated wrong value (idk reason fingerprint family generated correct value)

for example
python

>>> farmhash.hash64('foo')
6150913649986995171
>>> farmhash.fingerprint64('foo')
6150913649986995171
>>>

farmhash-modern

> x.hash64('foo')
6150913649986995171n
> x.fingerprint64('foo')
6150913649986995171n

but farmhash

> fh.hash64('foo')
'444527491298465133'
> fh.fingerprint64('foo')
'6150913649986995171'

is it bug or do i miss something?

unable to run `yarn build` when using this package

hello! i'm trying to use this package and yarn build is producing the error below.

ERROR in ./node_modules/farmhash/build/Release/farmhash.node 1:0
Module parse failed: Unexpected character '�' (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
(Source code omitted for this binary file)
 @ ./node_modules/farmhash/index.js 3:17-57

yarn: 1.19.1
node: 10.16.3

used yarn add farmhash to install the package (was successful), and i'm able to use it just fine with tests. i only have issues when trying to run yarn build. any advice on how to resolve?

Build Error on Windows: '__builtin_expect' identifier not found

Error

..\src\upstream\farmhash.cc(1378): error C3861: '__builtin_expect': identifier not found [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]

Versions

OS: Windows 10 Tech Preview
node 0.10.35
npm 1.4.28
node-gyp 1.0.1

Output

C:\Users\Jonas\Code\node-hexadb>npm i --save farmhash
npm http GET https://registry.npmjs.org/farmhash
npm http 200 https://registry.npmjs.org/farmhash
npm http GET https://registry.npmjs.org/farmhash/-/farmhash-0.1.0.tgz
npm http 200 https://registry.npmjs.org/farmhash/-/farmhash-0.1.0.tgz
npm http GET https://registry.npmjs.org/nan
npm http 200 https://registry.npmjs.org/nan
npm http GET https://registry.npmjs.org/nan/-/nan-1.4.1.tgz
npm http 200 https://registry.npmjs.org/nan/-/nan-1.4.1.tgz

> [email protected] install C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash
> node-gyp rebuild


C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash>node "C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V120\Microsoft.CppBuild.targets(942,5): warning MSB8027: Two or more files with the name of farmhash.cc will produce outputs to the same location. This can lead to an incorrect build result.  The files involved are ..\src\upstream\farmhash.cc, ..\src\farmhash.cc. [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
  farmhash.cc
  farmhash.cc
..\src\upstream\farmhash.cc(407): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(481): warning C4307: '*' : integral constant overflow [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(548): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(566): warning C4267: 'argument' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(570): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(585): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(641): warning C4267: 'argument' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(650): warning C4267: 'return' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(873): warning C4267: 'return' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(902): warning C4267: 'return' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1128): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1141): warning C4267: 'argument' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1145): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1160): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1227): warning C4267: 'argument' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1277): warning C4267: 'initializing' : conversion from 'size_t' to 'uint32_t', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1316): warning C4267: 'initializing' : conversion from 'size_t' to 'long', possible loss of data [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
..\src\upstream\farmhash.cc(1378): error C3861: '__builtin_expect': identifier not found [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\include\xlocale(337): warning C4530: C++ exception handler used, but unwind semantics are not enabled. Specify /EHsc (..\src\farmhash.cc) [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
C:\Users\Jonas\.node-gyp\0.10.35\deps\v8\include\v8.h(179): warning C4506: no definition for inline function 'v8::Persistent<v8::Object> v8::Persistent<v8::Object>::New(v8::Handle<v8::Object>)' (..\src\farmhash.cc) [C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash\build\farmhash.vcxproj]
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\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:820:12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\\Program Files\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Users\Jonas\Code\node-hexadb\node_modules\farmhash
gyp ERR! node -v v0.10.35
gyp ERR! node-gyp -v v1.0.1
gyp ERR! not ok

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 most likely a problem with the farmhash 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 their info via:
npm ERR!     npm owner ls farmhash
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "i" "--save" "farmhash"
npm ERR! cwd C:\Users\Jonas\Code\node-hexadb
npm ERR! node -v v0.10.35
npm ERR! npm -v 1.4.28
npm ERR! code ELIFECYCLE
npm ERR! not ok code 0

Does not build on FreeBSD 10.3-RELEASE-p4

Runs blazingly fast on my Mac, sadly doesnt build on our production machines.

gyp verb get node dir target node version installed: 6.9.2
gyp verb build dir attempting to create "build" dir: /usr/home/username/crawler.live/node_modules/farmhash/build
gyp verb build dir "build" dir needed to be created? /usr/home/username/crawler.live/node_modules/farmhash/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /usr/home/username/crawler.live/node_modules/farmhash/build/config.gypi
gyp verb config.gypi checking for gypi file: /usr/home/username/crawler.live/node_modules/farmhash/config.gypi
gyp verb common.gypi checking for gypi file: /usr/home/username/crawler.live/node_modules/farmhash/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/local/bin/python2
gyp info spawn args [ '/usr/local/lib/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   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/home/username/crawler.live/node_modules/farmhash/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/local/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/home/username/.node-gyp/6.9.2/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/home/username/.node-gyp/6.9.2',
gyp info spawn args   '-Dnode_gyp_dir=/usr/local/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=node.lib',
gyp info spawn args   '-Dmodule_root_dir=/usr/home/username/crawler.live/node_modules/farmhash',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /home/username/.node-gyp/6.9.2
gyp verb `which` succeeded for `gmake` /usr/local/bin/gmake
gyp info spawn gmake
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
gmake: Entering directory '/usr/home/username/crawler.live/node_modules/farmhash/build'
  c++ '-DNODE_GYP_MODULE_NAME=farmhash-legacy' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DFARMHASH_LEGACY' '-DBUILDING_NODE_EXTENSION' -I/home/username/.node-gyp/6.9.2/include/node -I/home/username/.node-gyp/6.9.2/src -I/home/username/.node-gyp/6.9.2/deps/uv/include -I/home/username/.node-gyp/6.9.2/deps/v8/include -I../node_modules/nan  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -fexceptions -Wall -Ofast -flto -funroll-loops -march=native -MMD -MF ./Release/.deps/Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o.d.raw   -c -o Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o ../src/upstream/farmhash-legacy.cc
  c++ '-DNODE_GYP_MODULE_NAME=farmhash-legacy' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DFARMHASH_LEGACY' '-DBUILDING_NODE_EXTENSION' -I/home/username/.node-gyp/6.9.2/include/node -I/home/username/.node-gyp/6.9.2/src -I/home/username/.node-gyp/6.9.2/deps/uv/include -I/home/username/.node-gyp/6.9.2/deps/v8/include -I../node_modules/nan  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -fno-rtti -fno-exceptions -std=gnu++0x -fexceptions -Wall -Ofast -flto -funroll-loops -march=native -MMD -MF ./Release/.deps/Release/obj.target/farmhash-legacy/src/bindings.o.d.raw   -c -o Release/obj.target/farmhash-legacy/src/bindings.o ../src/bindings.cc
  c++ -shared -pthread -rdynamic -m64 -Wl,--export-dynamic  -Wl,-soname=farmhash-legacy.node -o Release/obj.target/farmhash-legacy.node -Wl,--start-group Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o Release/obj.target/farmhash-legacy/src/bindings.o -Wl,--end-group
Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o: file not recognized: File format not recognized
c++: error: linker command failed with exit code 1 (use -v to see invocation)
gmake: *** [farmhash-legacy.target.mk:139: Release/obj.target/farmhash-legacy.node] Error 1
gmake: Leaving directory '/usr/home/username/crawler.live/node_modules/farmhash/build'
gyp ERR! build error
gyp ERR! stack Error: `gmake` 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:191:7)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:12)
gyp ERR! System FreeBSD 10.3-RELEASE-p4
gyp ERR! command "/usr/local/bin/node" "/usr/local/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /usr/home/username/crawler.live/node_modules/farmhash
gyp ERR! node -v v6.9.2
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
npm verb lifecycle [email protected]~install: unsafe-perm in lifecycle true
npm verb lifecycle [email protected]~install: PATH: /usr/local/lib/node_modules/npm/bin/node-gyp-bin:/usr/home/username/crawler.live/node_modules/farmhash/node_modules/.bin:/usr/home/username/crawler.live/node_modules/.bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/games:/usr/local/sbin:/usr/local/bin:/home/username/bin
npm verb lifecycle [email protected]~install: CWD: /usr/home/username/crawler.live/node_modules/farmhash
npm info lifecycle [email protected]~install: Failed to exec install script
npm verb unlock done using /home/username/.npm/_locks/staging-b2903843cfb30894.lock for /usr/home/username/crawler.live/node_modules/.staging
npm verb stack Error: [email protected] install: `node-gyp rebuild`
npm verb stack Exit status 1
npm verb stack     at EventEmitter.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at EventEmitter.emit (events.js:191:7)
npm verb stack     at ChildProcess.<anonymous> (/usr/local/lib/node_modules/npm/lib/utils/spawn.js:40:14)
npm verb stack     at emitTwo (events.js:106:13)
npm verb stack     at ChildProcess.emit (events.js:191:7)
npm verb stack     at maybeClose (internal/child_process.js:877:16)
npm verb stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
npm verb pkgid [email protected]
npm verb cwd /usr/home/username/crawler.live
npm ERR! FreeBSD 10.3-RELEASE-p4
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "farmhash" "--verbose"
npm ERR! node v6.9.2
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE

ReferenceError: require is undefined

For anyone else running into this issue -

While attempting to use this module from an ES6 module, (type: "module" in package.json) I get the following error:

ReferenceError: require is not defined
    at /@fs/Users/dwight/Development/project/node_modules/.pnpm/[email protected]/node_modules/farmhash/index.js:3:18
    at instantiateModule 

This corresponds to the require code here -

return require('./build/Release/farmhash.node');

I attempted to add a type: "commonjs" key to the farmhash package.json but that didn't help.

I was able to get past the error by importing farmhash using:

// lib/vendor/farmhash.ts
import { createRequire } from 'module'
const require = createRequire(import.meta.url)
const farmhash = require('farmhash')

export default farmhash
// app.ts

import farmhash from './lib/vendor/farmhash'

// ...

I'm not too sure how to fix the issue since I was unable to get the package to build in my fork. But hopefully this helps.

Won't build, Shuffle2031 error

Hello, I had farmhash building fine the other day, but tried messing about upgrading node to v6, it broke stuff and I reverted to 5, but now farmhash seems to have stopped working/building. My error is as follows, but the npm install continues fine afterwards:

> [email protected] install /Users/matt/work/personal/finances/node_modules/farmhash
> node-gyp rebuild

  CXX(target) Release/obj.target/farmhash-legacy/src/upstream/farmhash-legacy.o
../src/upstream/farmhash-legacy.cc:684:23: warning: unused function 'Shuffle2031' [-Wunused-function]
STATIC_INLINE __m128i Shuffle2031(__m128i x) {
                      ^
1 warning generated.
  CXX(target) Release/obj.target/farmhash-legacy/src/bindings.o
  SOLINK_MODULE(target) Release/farmhash-legacy.node
  CXX(target) Release/obj.target/farmhash/src/upstream/farmhash.o
  CXX(target) Release/obj.target/farmhash/src/bindings.o
  SOLINK_MODULE(target) Release/farmhash.node

I then have this issue when I try and build with browserify, showing it's clearly not build farmhash properly:

> [email protected] build /Users/matt/work/personal/finances
> browserify -t [babelify --presets es2015 --presets react --presets stage-0] -p [css-modulesify --global -o client/public/bundle.css] -o client/public/bundle.js client/lib/main.jsx

Error: Cannot find module './build/Release/farmhash' from '/Users/matt/work/personal/finances/node_modules/farmhash'
    at /Users/matt/work/personal/finances/node_modules/resolve/lib/async.js:55:21
    at load (/Users/matt/work/personal/finances/node_modules/resolve/lib/async.js:69:43)
    at onex (/Users/matt/work/personal/finances/node_modules/resolve/lib/async.js:92:31)
    at /Users/matt/work/personal/finances/node_modules/resolve/lib/async.js:22:47
    at FSReqWrap.oncomplete (fs.js:82:15)

npm ERR! Darwin 13.4.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "build"
npm ERR! node v5.12.0
npm ERR! npm  v3.8.6
npm ERR! code ELIFECYCLE

Any ideas @lovell?

Many thanks 😄

node-gyp rebuild fail on AWS Elastic Beanstalk

Hi,

Nice module! I have tried on my local and everything works fine.
However, it gets rebuild fail when I was trying to deploying onto my AWS EB app, here's the partial log:

1058 verbose rebuildBundles [email protected]
1059 info lifecycle [email protected]~install: [email protected]
1060 verbose lifecycle [email protected]~install: unsafe-perm in lifecycle false
1061 verbose lifecycle [email protected]~install: PATH: /opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/lib/node_modules/npm/bin/node-gyp-bin:/tmp/deployment/application/node_modules/farmhash/node_modules/.bin:/tmp/deployment/application/node_modules/.bin:/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin:/opt/elasticbeanstalk/lib/ruby/bin:/usr/local/sbin:/usr/local/bin:/usr/bin:/usr/sbin:/sbin:/bin
1062 verbose lifecycle [email protected]~install: CWD: /tmp/deployment/application/node_modules/farmhash
1063 silly lifecycle [email protected]~install: Args: [ '-c', 'node-gyp rebuild' ]
1064 silly lifecycle [email protected]~install: Returned: code: 1  signal: null
1065 info lifecycle [email protected]~install: Failed to exec install script
1066 verbose stack Error: [email protected] install: `node-gyp rebuild`
1066 verbose stack Exit status 1
1066 verbose stack     at EventEmitter.<anonymous> (/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/lib/node_modules/npm/lib/utils/lifecycle.js:255:16)
1066 verbose stack     at emitTwo (events.js:106:13)
1066 verbose stack     at EventEmitter.emit (events.js:191:7)
1066 verbose stack     at ChildProcess.<anonymous> (/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/lib/node_modules/npm/lib/utils/spawn.js:40:14)
1066 verbose stack     at emitTwo (events.js:106:13)
1066 verbose stack     at ChildProcess.emit (events.js:191:7)
1066 verbose stack     at maybeClose (internal/child_process.js:877:16)
1066 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
1067 verbose pkgid [email protected]
1068 verbose cwd /tmp/deployment/application
1069 error Linux 4.4.23-31.54.amzn1.x86_64
1070 error argv "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/node" "/opt/elasticbeanstalk/node-install/node-v6.9.1-linux-x64/bin/npm" "--production" "rebuild"
1071 error node v6.9.1
1072 error npm  v3.10.8
1073 error code ELIFECYCLE
1074 error [email protected] install: `node-gyp rebuild`
1074 error Exit status 1
1075 error Failed at the [email protected] install script 'node-gyp rebuild'.
1075 error Make sure you have the latest version of node.js and npm installed.

Any suggestion?

Environment: 64bit Amazon Linux 2016.09 v3.1.0 running Node.js
Node.js version: v6.9.1
NPM version: NPM 2.15.5

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.