openvenues / node-postal Goto Github PK
View Code? Open in Web Editor NEWNodeJS bindings to libpostal for fast international address parsing/normalization
License: MIT License
NodeJS bindings to libpostal for fast international address parsing/normalization
License: MIT License
Hi, thanks for making node-postal. It seems to be the best option short of paying for a monthly subscription. However, the keys returned with parse_address
are not documented. Is there a list of all of them somewhere? It looks like they aren't all in the tests, either.
I've been hoping for something like this for a long time. I'm also hoping to get it running : ). Even though installation instructions are fairly thorough, there are a couple confusing parts I'm hoping someone can clear up for myself and others.
node-postal
can find it?sudo npm install -g node-gyp
is needed, but are the steps above needed?node-gyp
installs based on node version, so I would assume this would?For both node 5.x and 6.x, I'm getting these errors:
~/git/jefffriesen/data-pipeline/libpostal[master+]$ npm install openvenues/node-postal --save
> [email protected] install /Users/jeffers/git/jefffriesen/data-pipeline/node_modules/node-postal
> (node-gyp rebuild) || (exit 0)
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
gyp WARN download NVM_NODEJS_ORG_MIRROR is deprecated and will be removed in node-gyp v4, please use NODEJS_ORG_MIRROR
CXX(target) Release/obj.target/expand/src/expand.o
../src/expand.cc:1:10: fatal error: 'libpostal/libpostal.h' file not found
#include <libpostal/libpostal.h>
^
1 error generated.
make: *** [Release/obj.target/expand/src/expand.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/jeffers/.nvm/versions/node/v5.10.1/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:276:23)
gyp ERR! stack at emitTwo (events.js:100:13)
gyp ERR! stack at ChildProcess.emit (events.js:185:7)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:204:12)
gyp ERR! System Darwin 15.6.0
gyp ERR! command "/Users/jeffers/.nvm/versions/node/v5.10.1/bin/node" "/Users/jeffers/.nvm/versions/node/v5.10.1/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/jeffers/git/jefffriesen/data-pipeline/node_modules/node-postal
gyp ERR! node -v v5.10.1
gyp ERR! node-gyp -v v3.3.1
gyp ERR! not ok
I got no errors on any of the previous install steps, unless this is an error
Checking for new libpostal geodb data file...
New libpostal geodb data file available
Downloading multipart: http://libpostal.s3.amazonaws.com/geodb.tar.gz, size=486746092, num_chunks=7
...
Downloading part 7: filename=/Users/jeffers/git/libpostal_data/libpostal/geodb.tar.gz.7, offset=402653184, max=486746092
make[3]: *** [all-local] Error 1
make[2]: *** [all-recursive] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Any suggestions or clarifications on installation? Thank you
I am having issues building the bindings, subject contains the key error.
I am using CentOS version 8.4.2105 with Node v16.0.0 installed via NodeJS provided RPM
Make install of libpostal seemed to pose no issue.
I will attempt using some older version of node, starting with 12 to see if I can get it to build.
The output of performing npm install is attached
Hi we have facing issue on make node-postal working. All 3+Gb of data has been downloaded and postal c library works perfectly so we can parse address via command line utility.
Sadly we spent 3+ hours to make node-postal working with no luck.
We are working on Ubuntu 16.4.0.2
Node 7.7.2
this is the result of node:
`node main.js
/home/ufficio/libpostal/node/node_modules/bindings/bindings.js:90
throw err
^
Error: Could not locate the bindings file. Tried:
→ /home/ufficio/libpostal/node/node_modules/node-postal/build/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/build/Debug/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/build/Release/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/out/Debug/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/Debug/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/out/Release/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/Release/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/build/default/expand.node
→ /home/ufficio/libpostal/node/node_modules/node-postal/compiled/7.7.2/linux/x64/expand.node
at bindings (/home/ufficio/libpostal/node/node_modules/bindings/bindings.js:87:9)
at Object. (/home/ufficio/libpostal/node/node_modules/node-postal/index.js:3:32)
at Module._compile (module.js:571:32)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:488:32)
at tryModuleLoad (module.js:447:12)
at Function.Module._load (module.js:439:3)
at Module.require (module.js:498:17)
at require (internal/module.js:20:19)
at Object. (/home/ufficio/libpostal/node/main.js:2:14)
`
thanks a lot
It doesn't seem like there is an NPM update available after the new pull request just got merged (#25) that supports node v12. Is that something that can be added? As a temporary measure I've been using the forked repo https://github.com/kembuco/node-postal as my dependency, but would like to switch back to this repo as soon as it gets published.
no maintainer since 2021??
I tried to install and use node-postal today and continue to get an error. I'm using MacOS Version 11.2.3 (Big Sur), node v12.16.2. I can run libpostal cli via terminal just fine, so I'm pretty sure I did the installation of libpostal correctly. Any suggestions?
/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/bindings/bindings.js:135
throw err;
^
Error: Could not locate the bindings file. Tried:
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/Debug/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/Release/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/out/Debug/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/Debug/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/out/Release/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/Release/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/build/default/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/compiled/12.16.2/darwin/x64/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/addon-build/release/install-root/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/addon-build/debug/install-root/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/addon-build/default/install-root/expand.node
→ /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/lib/binding/node-v72-darwin-x64/expand.node
at bindings (/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/bindings/bindings.js:126:9)
at Object.<anonymous> (/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/node_modules/node-postal/index.js:3:32)
Here's the output of node-gyp rebuild
as requested in the read me:
% node-gyp rebuild
gyp info it worked if it ends with ok
gyp info using [email protected]
gyp info using [email protected] | darwin | x64
gyp info find Python using Python version 3.7.3 found at "/usr/local/bin/python3"
gyp info spawn /usr/local/bin/python3
gyp info spawn args [
gyp info spawn args '/usr/local/lib/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args 'binding.gyp',
gyp info spawn args '-f',
gyp info spawn args 'make',
gyp info spawn args '-I',
gyp info spawn args '/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp/build/config.gypi',
gyp info spawn args '-I',
gyp info spawn args '/usr/local/lib/node_modules/node-gyp/addon.gypi',
gyp info spawn args '-I',
gyp info spawn args '/Users/wyattgrantham/Library/Caches/node-gyp/12.16.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/wyattgrantham/Library/Caches/node-gyp/12.16.2',
gyp info spawn args '-Dnode_gyp_dir=/usr/local/lib/node_modules/node-gyp',
gyp info spawn args '-Dnode_lib_file=/Users/wyattgrantham/Library/Caches/node-gyp/12.16.2/<(target_arch)/node.lib',
gyp info spawn args '-Dmodule_root_dir=/Users/wyattgrantham/Documents/GitHub/lsp/api-lsp',
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: binding.gyp not found (cwd: /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp) while trying to load binding.gyp
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/local/lib/node_modules/node-gyp/lib/configure.js:351:16)
gyp ERR! stack at ChildProcess.emit (events.js:310:20)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:275:12)
gyp ERR! System Darwin 20.3.0
gyp ERR! command "/usr/local/bin/node" "/usr/local/bin/node-gyp" "rebuild"
gyp ERR! cwd /Users/wyattgrantham/Documents/GitHub/lsp/api-lsp
gyp ERR! node -v v12.16.2
gyp ERR! node-gyp -v v8.0.0
gyp ERR! not ok
libpostal on master [?] via C v15.0.0-clang took 29s
❯ system_profiler SPSoftwareDataType
Software:
System Software Overview:
System Version: macOS 13.5 (22G74)
Kernel Version: Darwin 22.6.0
Boot Volume: Macintosh HD
Boot Mode: Normal
Computer Name: EB-KD96KV36L0
User Name: Geoff Langenderfer (geoff.langerderfer)
Secure Virtual Memory: Enabled
System Integrity Protection: Enabled
Time since boot: 10 days, 9 hours, 55 minutes
libpostal on master [?] via C v15.0.0-clang
❯
libpostal on master [?] via C v15.0.0-clang took 16s
❮ git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
mkdir libpostal_datadir
./configure --datadir=$(pwd)/libpostal_datadir
make
sudo make install
checking for a BSD-compatible install... /usr/bin/install -c
checking whether build environment is sane... yes
checking for a race-free mkdir -p... ./install-sh -c -d
checking for gawk... no
checking for mawk... no
checking for nawk... no
checking for awk... awk
checking whether make sets $(MAKE)... yes
checking whether make supports nested variables... yes
checking build system type... aarch64-apple-darwin22.6.0
checking host system type... aarch64-apple-darwin22.6.0
checking how to print strings... printf
checking whether make supports the include directive... yes (GNU style)
checking for gcc... gcc
checking whether the C compiler works... yes
checking for C compiler default output file name... a.out
checking for suffix of executables...
checking whether we are cross compiling... no
checking for suffix of object files... o
checking whether the compiler supports GNU C... yes
checking whether gcc accepts -g... yes
checking for gcc option to enable C11 features... none needed
checking whether gcc understands -c and -o together... yes
checking dependency style of gcc... gcc3
checking for a sed that does not truncate output... /usr/bin/sed
checking for grep that handles long lines and -e... /usr/bin/grep
checking for egrep... /usr/bin/grep -E
checking for fgrep... /usr/bin/grep -F
checking for ld used by gcc... /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld
checking if the linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) is GNU ld... no
checking for BSD- or MS-compatible name lister (nm)... /usr/bin/nm -B
checking the name lister (/usr/bin/nm -B) interface... BSD nm
checking whether ln -s works... yes
checking the maximum length of command line arguments... 786432
checking how to convert aarch64-apple-darwin22.6.0 file names to aarch64-apple-darwin22.6.0 format... func_convert_file_noop
checking how to convert aarch64-apple-darwin22.6.0 file names to toolchain format... func_convert_file_noop
checking for /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld option to reload object files... -r
checking for file... file
checking for objdump... objdump
checking how to recognize dependent libraries... pass_all
checking for dlltool... no
checking how to associate runtime and link libraries... printf %s\n
checking for ar... ar
checking for archiver @FILE support... no
checking for strip... strip
checking for ranlib... ranlib
checking command to parse /usr/bin/nm -B output from gcc object... ok
checking for sysroot... no
checking for a working dd... /bin/dd
checking how to truncate binary pipes... /bin/dd bs=4096 count=1
checking for mt... no
checking if : is a manifest tool... no
checking for dsymutil... dsymutil
checking for nmedit... nmedit
checking for lipo... lipo
checking for otool... otool
checking for otool64... no
checking for -single_module linker flag... ld: warning: -single_module is obsolete
no
checking for -exported_symbols_list linker flag... yes
checking for -force_load linker flag... yes
checking for stdio.h... yes
checking for stdlib.h... yes
checking for string.h... yes
checking for inttypes.h... yes
checking for stdint.h... yes
checking for strings.h... yes
checking for sys/stat.h... yes
checking for sys/types.h... yes
checking for unistd.h... yes
checking for sys/time.h... yes
checking for dlfcn.h... yes
checking for objdir... .libs
checking if gcc supports -fno-rtti -fno-exceptions... yes
checking for gcc option to produce PIC... -fno-common -DPIC
checking if gcc PIC flag -fno-common -DPIC works... yes
checking if gcc static flag -static works... no
checking if gcc supports -c -o file.o... yes
checking if gcc supports -c -o file.o... (cached) yes
checking whether the gcc linker (/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ld) supports shared libraries... yes
checking dynamic linker characteristics... darwin22.6.0 dyld
checking how to hardcode library paths into programs... immediate
checking whether stripping libraries is possible... yes
checking if libtool supports shared libraries... yes
checking whether to build shared libraries... yes
checking whether to build static libraries... yes
checking for library containing log... none required
checking for egrep... (cached) /usr/bin/grep -E
checking for dirent.h that defines DIR... yes
checking for library containing opendir... none required
checking for _Bool... yes
checking for stdbool.h that conforms to C99... yes
checking for fcntl.h... yes
checking for float.h... yes
checking for inttypes.h... (cached) yes
checking for limits.h... yes
checking for locale.h... yes
checking for malloc.h... no
checking for memory.h... yes
checking for stddef.h... yes
checking for stdint.h... (cached) yes
checking for stdlib.h... (cached) yes
checking for string.h... (cached) yes
checking for unistd.h... (cached) yes
checking for inline... inline
checking for int16_t... yes
checking for int32_t... yes
checking for int64_t... yes
checking for int8_t... yes
checking for off_t... yes
checking for size_t... yes
checking for ssize_t... yes
checking for uint16_t... yes
checking for uint32_t... yes
checking for uint64_t... yes
checking for uint8_t... yes
checking for ptrdiff_t... yes
checking for malloc... yes
checking for realloc... yes
checking for drand48... yes
checking for getcwd... yes
checking for gettimeofday... yes
checking for memmove... yes
checking for memset... yes
checking for regcomp... yes
checking for setlocale... yes
checking for sqrt... yes
checking for strdup... yes
checking for strndup... yes
checking for shuf... no
checking for gshuf... no
checking for cblas.h... no
configure: extra cflags for scanner.c:
checking that generated files are newer than configure... done
configure: creating ./config.status
config.status: creating Makefile
chmod: src/libpostal_data: No such file or directory
config.status: creating libpostal.pc
chmod: src/libpostal_data: No such file or directory
config.status: creating src/Makefile
chmod: src/libpostal_data: No such file or directory
config.status: creating src/libpostal_data
config.status: creating test/Makefile
config.status: creating config.h
config.status: executing depfiles commands
config.status: executing libtool commands
/Applications/Xcode.app/Contents/Developer/usr/bin/make all-recursive
Making all in src
gcc -DHAVE_CONFIG_H -I.. -I/usr/local/include -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR='"/Users/geoff.langerderfer/work/api-v1/libpostal/libpostal_datadir/libpostal"' -g -mfpmath=sse -msse2 -DUSE_SSE -g -O2 -O3 -MT libpostal-strndup.o -MD -MP -MF .deps/libpostal-strndup.Tpo -c -o libpostal-strndup.o `test -f 'strndup.c' || echo './'`strndup.c
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
error: unknown FP unit 'sse'
make[2]: *** [libpostal-strndup.o] Error 1
make[1]: *** [all-recursive] Error 1
make: *** [all] Error 2
Making install in src
gcc -DHAVE_CONFIG_H -I.. -I/usr/local/include -Wall -Wextra -Wno-unused-function -Wformat -Werror=format-security -Winit-self -Wno-sign-compare -DLIBPOSTAL_DATA_DIR='"/Users/geoff.langerderfer/work/api-v1/libpostal/libpostal_datadir/libpostal"' -g -mfpmath=sse -msse2 -DUSE_SSE -g -O2 -O3 -MT libpostal-strndup.o -MD -MP -MF .deps/libpostal-strndup.Tpo -c -o libpostal-strndup.o `test -f 'strndup.c' || echo './'`strndup.c
clang: warning: argument unused during compilation: '-msse2' [-Wunused-command-line-argument]
error: unknown FP unit 'sse'
make[1]: *** [libpostal-strndup.o] Error 1
make: *** [install-recursive] Error 1
Hello, !
I got a failed test when running npm test. The 6 others are OK.
Ubuntu 15.04
Node v4.2.6
node-postal 0.3.0 (just cloned)
[email protected] test /root/test/node-postal
mocha ./test
expand
expand_address
✓ should correctly expand a US address
✓ should correctly dedupe equivalent addresses
{ _items:
[ 'friedrichstrasse 128 berlin germany',
'friedrich strasse 128 berlin germany' ] }
1) should handle non-ASCII addresses correctly from Node
parser
parse_address
✓ should parse a US address
✓ should parse a venue and state
✓ should parse house/apt style house_number
✓ should parse different comma styles correctly
6 passing (22ms)
1 failing
AssertionError: false == true
+ expected - actual
-false
+true
at Context.<anonymous> (test/index.test.js:21:13)
npm ERR! Test failed. See above for more details.
Thank you!
Is it possible to build libpostal as part of the npm install
process? It will save the effort of installing libpostal separately.
> [email protected] install /root/courier-bhanuc/node_modules/node-postal
> (node-gyp rebuild) || (exit 0)
Traceback (most recent call last):
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/gyp_main.py", line 13, in <module>
import gyp
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/__init__.py", line 8, in <module>
import gyp.input
File "/usr/lib/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py", line 5, in <module>
from compiler.ast import Const
ImportError: No module named compiler.ast
gyp ERR! configure error
gyp ERR! stack Error: `gyp` failed with exit code: 1
gyp ERR! stack at ChildProcess.onCpExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js:305:16)
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 Linux 4.4.0-45-generic
gyp ERR! command "/usr/bin/nodejs" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /root/courier-bhanuc/node_modules/node-postal
gyp ERR! node -v v6.9.1
gyp ERR! node-gyp -v v3.4.0
gyp ERR! not ok
any help on the issue would be great. Please comment here if can help
I have set up the installation files on windows and I am able to run it using command line utility. But the problem is when I set up the node bindings with "npm install openvenues/node-postal", it gives me stack of error messages. Please see below:
\AppData\Roaming\npm\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\....\node_modules\node-gyp\bin\no
de-gyp.js" rebuild ) else (node "C:\Roaming\npm\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.
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error
MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK vers
ion in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:
\Libpostal\libpostal\src\node_modules\node-postal\build\expand.vcxproj]
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\V140\Platforms\x64\PlatformToolsets\v140\Toolset.targets(36,5): error
MSB8036: The Windows SDK version 8.1 was not found. Install the required version of Windows SDK or change the SDK vers
ion in the project property pages or by right-clicking the solution and selecting "Retarget solution". [C:
\Libpostal\libpostal\src\node_modules\node-postal\build\parser.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:\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp
lib\build.js:258: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 Windows_NT 6.1.7601
gyp ERR! command "C:\Program Files\nodejs\node.exe" "C:\AppData\Roaming\npm\node_modules\npm\
ode_modules\node-gyp\bin\node-gyp.js" "rebuild"
gyp ERR! cwd C:\Libpostal\libpostal\src\node_modules\node-postal
gyp ERR! node -v v6.11.0
gyp ERR! node-gyp -v v3.6.2
gyp ERR! not ok
npm WARN saveError ENOENT: no such file or directory, open 'C:\Libpostal\libpostal\src\package.json'
npm WARN enoent ENOENT: no such file or directory, open 'C:\Libpostal\libpostal\src\package.json'
npm WARN src No description
npm WARN src No repository field.
npm WARN src No README data
npm WARN src No license field.
Can you help me resolve the error?
ignore this
I don't have sudo access to the server I'm working on, so I installed libpostal into ~/local/lib
. My LD_LIBRARY_PATH
is set correctly, and the libpostal tests passed so I believe it installed correctly. But npm install node-postal
fails because it can't find libpostal/libpostal.h
. Is it possible to install node-postal using the local library path?
I tried installing node-postal on the latest LTS version of node (v12.18.3) and get the following errors (it builds and works fine on node v10.x). I've tried every solution that comes up on a Google search for this error and still get the same result. This is on Macos Catalina v10.15.6
19 warnings and 2 errors generated.
make: *** [Release/obj.target/expand/src/expand.o] Error 1
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/Users/xxxxx/.nvm/versions/node/v12.18.3/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 Darwin 19.6.0
gyp ERR! command "/Users/xxxxx/.nvm/versions/node/v12.18.3/bin/node" "/Users/xxxxx/.nvm/versions/node/v12.18.3/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /Users/xxxxx/dev/libtest/node_modules/node-postal
gyp ERR! node -v v12.18.3
gyp ERR! node-gyp -v v5.1.0
gyp ERR! not ok
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN [email protected] No description
npm WARN [email protected] No repository field.
pypostal has all of these options available:
https://github.com/openvenues/pypostal/blob/master/postal/expand.py#L17-L51
node-postal has direct-to-c sorcery: expand: require('bindings')('expand')
. It looks like you can't pass options in (and I couldn't by trial and error).
Is there a way to expose options for the node binding? Or if you can use them, how?
Thanks
is it possible to share the libpostal memory between two different nodejs processes calling require('node-postal')
on the same machine?
calling require('node-postal')
uses a fair chunk of RAM so having two different services on the same machine using node-postal consumes more RAM than maybe it needs to?
I'm assuming that the memory is read-only so would it be possible to share that memory between processes?
Hi,
Since i'd like to reinstall in the aim to test the 1.0 version, i have some error with node-gyp build.
> [email protected] install /home/sragneau/node-postal
> (node-gyp rebuild) || (exit 0)
make : on entre dans le répertoire « /home/sragneau/node-postal/build »
CXX(target) Release/obj.target/expand/src/expand.o
../src/expand.cc: In function ‘Nan::NAN_METHOD_RETURN_TYPE ExpandAddress(Nan::NAN_METHOD_ARGS_TYPE)’:
../src/expand.cc:26:5: error: ‘libpostal_normalize_options_t’ was not declared in this scope
libpostal_normalize_options_t options = libpostal_get_default_options();
^
../src/expand.cc:55:64: error: ‘LIBPOSTAL_MAX_LANGUAGE_LEN’ was not declared in this scope
if (lang != NULL && strlen(lang) < LIBPOSTAL_MAX_LANGUAGE_LEN) {
^
../src/expand.cc:63:25: error: ‘options’ was not declared in this scope
options.address_components = (uint16_t) Nan::To<uint32_t>(value).FromJust();
^
../src/expand.cc:66:21: error: ‘options’ was not declared in this scope
options.latin_ascii = Nan::To<bool>(value).FromJust();
^
../src/expand.cc:68:21: error: ‘options’ was not declared in this scope
options.transliterate = Nan::To<bool>(value).FromJust();
^
../src/expand.cc:70:21: error: ‘options’ was not declared in this scope
options.strip_accents = Nan::To<bool>(value).FromJust();
^
It is cause by my machine or by the new version ?
Thanks you
https://github.com/openvenues/node-postal/blob/master/package.json#L34
"install": "(node-gyp rebuild) || (exit 0)",
-> "install": "node-gyp rebuild"
After fixing this i get
libpostal/libpostal.h
not found
I would really love to see node-postal
published to the NPM registry. Any changes on doing that ?
The problem is, other projects now need to depend on node-postal
as a github dependency in their package.json and that really doesn't work in offline environments (using npm-mirror
or similar).
I'm available for assistance if needed.
has anyone experienced this?
root@f34e0cbbc3d5:/app/user# node
> require("node-postal");
Segmentation fault
Same using the bin directly!
root@f34e0cbbc3d5:/app/user# ./libpostal/src/libpostal "Quatre vignt douze Ave des Champs-lyses"
Segmentation fault
I'm trying to var postal = require('node-postal');
But the system keeps saying errors as below:
[email protected] start /home/ups_poc/webapp
node ./bin/www/home/ups_poc/webapp/node_modules/bindings/bindings.js:88
throw e
^Error: libpostal.so.1: cannot open shared object file: No such file or directory
at Object.Module._extensions..node (module.js:664:18)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
at Function.Module._load (module.js:489:3)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at bindings (/home/ups_poc/webapp/node_modules/bindings/bindings.js:81:44)
at Object. (/home/ups_poc/webapp/node_modules/node-postal/index.js:3:32)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] start:node ./bin/www
npm ERR! Exit status 1
npm ERR!
The detail log as below:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle [email protected]prestart: [email protected]start: [email protected]
6 info lifecycle [email protected]
7 verbose lifecycle [email protected]start: unsafe-perm in lifecycle truestart: PATH: /usr/lib/node_modules/npm/bin/node-gyp-bin:/home/ups_poc/webapp/node_modules/.bin:/usr/local/bin:/usr/bin:/usr/local/sbin:/usr/sbin:/home/ups_poc/.local/bin:/home/ups_poc/bin
8 verbose lifecycle [email protected]
9 verbose lifecycle [email protected]start: CWD: /home/ups_poc/webappstart: Args: [ '-c', 'node ./bin/www' ]
10 silly lifecycle [email protected]
11 silly lifecycle [email protected]start: Returned: code: 1 signal: nullstart: Failed to exec start script
12 info lifecycle [email protected]
13 verbose stack Error: [email protected] start:node ./bin/www
13 verbose stack Exit status 1
13 verbose stack at EventEmitter. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/index.js:280:16)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at EventEmitter.emit (events.js:214:7)
13 verbose stack at ChildProcess. (/usr/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:55:14)
13 verbose stack at emitTwo (events.js:126:13)
13 verbose stack at ChildProcess.emit (events.js:214:7)
13 verbose stack at maybeClose (internal/child_process.js:925:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:209:5)
14 verbose pkgid [email protected]
15 verbose cwd /home/ups_poc/webapp
16 verbose Linux 3.10.0-693.5.2.el7.x86_64
17 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
18 verbose node v8.9.1
19 verbose npm v5.5.1
20 error code ELIFECYCLE
21 error errno 1
22 error [email protected] start:node ./bin/www
22 error Exit status 1
23 error Failed at the [email protected] start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Could someone help me with this error? I used CentOS 7.4
node -v == v13.1.0
npm -v == 6.12.1
I can successfully use address parser..
error log ==
/home/ec2-user/.cache/node-gyp/13.1.0/include/node/v8.h:3427:37: note: candidate expects 3 arguments, 2 provided make: *** [Release/obj.target/expand/src/expand.o] Error 1 make: Leaving directory
/efs/pelias-code/interpolation/node_modules/node-postal/build'
gyp ERR! build error
gyp ERR! stack Error: make
failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/ec2-user/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack at ChildProcess.emit (events.js:210:5)
gyp ERR! stack at Process.ChildProcess._handle.onexit (internal/child_process.js:272:12)
gyp ERR! System Linux 4.14.146-120.181.amzn2.x86_64
gyp ERR! command "/home/ec2-user/.nvm/versions/node/v13.1.0/bin/node" "/home/ec2-user/.nvm/versions/node/v13.1.0/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /efs/pelias-code/interpolation/node_modules/node-postal
gyp ERR! node -v v13.1.0
gyp ERR! node-gyp -v v5.0.5
gyp ERR! not ok
i have followed the instruction as in the doc
Following are the steps of the execution
sudo yum install curl autoconf automake libtool pkgconfig
git clone https://github.com/openvenues/libpostal
cd libpostal
./bootstrap.sh
./configure
all above commands worked
/root/libpostal/src' make[1]: *** [all-recursive] Error 1 make[1]: Leaving directory
/root/libpostal'fatal error C1083: Cannot open include file: 'libpostal/libpost
al.h': No such file or directory [C:\libpostal\node_modules\node-postal\build\expand.vcxproj]
parser.cc
Hi, I have followed all these steps below to install libpostal (C library in itself is working for me):
git clone https://github.com/openvenues/libpostal
cd libpostal
cp -rf windows/* ./
./bootstrap.sh
./configure --datadir=[...some dir with a few GB of space...]
make -j4
make install
But when now I am trying to do
npm install openvenues/node-postal
it is throwing the below error:
C:\libpostal>npm install openvenues/node-postal
> [email protected] install C:\libpostal\node_modules\node-postal
> (node-gyp rebuild) || (exit 0)
C:\libpostal\node_modules\node-postal>if not defined npm_config_node_gyp (node "C:\ProgramData\nvm\v10.13.0\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin\\..\..\node_modules\node-gyp\bin\node-gyp.js" rebuild ) else (node "C:\ProgramData\nvm\v10.13.0\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.
expand.cc
win_delay_load_hook.cc
c:\libpostal\node_modules\node-postal\src\expand.cc(1): fatal error C1083: Cannot open include file: 'libpostal/libpost
al.h': No such file or directory [C:\libpostal\node_modules\node-postal\build\expand.vcxproj]
parser.cc
win_delay_load_hook.cc
c:\libpostal\node_modules\node-postal\src\parser.cc(1): fatal error C1083: Cannot open include file: 'libpostal/libpost
al.h': No such file or directory [C:\libpostal\node_modules\node-postal\build\parser.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Program Files (x86)\Microsoft Visual Studio\2017\BuildTools\MSBuild\15.0\Bin\MSBuild.exe` failed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\ProgramData\nvm\v10.13.0\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.18362
gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\ProgramData\\nvm\\v10.13.0\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
gyp ERR! cwd C:\libpostal\node_modules\node-postal
gyp ERR! node -v v10.13.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.
+ [email protected]
updated 1 package and audited 46 packages in 20.363s
found 0 vulnerabilities
Currently, only the Python binding exposes dedupe functionality. It would be nice if node-postal did as well.
I'm using this library in one of my Linux cloud servers and I've successfully done the setup and the NodeJs node-postal modules is also working as expected.
When I take an Image of the working server and create a new server the node-postal module is taking longer time to load in the nodejs application, but in the existing server when i turn that OFF and turn that ON again there is no such issue and the node-postal module loads faster & I can't see any difference.
So what is the issue when I create a new server out of an Image? and how to overcome the slow loading of the node-postal module during such cases?
I was getting this error originally
Error: Could not locate the bindings file. Tried:
→ /home/user/Documents/workspace/repos/.../.../node_modules/node-postal/build/expand.node
...
...continues on for a bit
...
When on Node v14.18.0, you have to do a node-gyp rebuild within the node-postal module folder, which builds successfully and will recreate the bindings. However when I would do this on Node v20.5.0 it was failing during the make stage
make: *** [expand.target.mk:115: Release/obj.target/expand/src/expand.o] Error 1
make: Leaving directory '/home/user/Documents/workspace/repos/.../.../node_modules/node-postal/build'
gyp ERR! build error
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack at ChildProcess.onExit (/home/zholland/.nvm/versions/node/v20.5.0/lib/node_modules/node-gyp/lib/build.js:203:23)
gyp ERR! stack at ChildProcess.emit (node:events:514:28)
gyp ERR! stack at ChildProcess._handle.onexit (node:internal/child_process:294:12)
gyp ERR! System Linux 6.0.6-76060006-generic
gyp ERR! command "/home/user/.nvm/versions/node/v20.5.0/bin/node" "/home/user/.nvm/versions/node/v20.5.0/bin/node-gyp" "rebuild"
gyp ERR! cwd /home/user/Documents/workspace/repos/.../.../node_modules/node-postal
gyp ERR! node -v v20.5.0
gyp ERR! node-gyp -v v9.4.0
gyp ERR! not ok
Spent a few hours researching both of those issues. I went through the debug logs and saw an error
../src/expand.cc: In function ‘void init(v8::Local<v8::Object>)’:
../src/expand.cc:136:47: error: ‘class v8::Object’ has no member named ‘CreationContext’; did you mean ‘GetCreationContext’?
136 | v8::Local<v8::Context> context = exports->CreationContext();
| ^~~~~~~~~~~~~~~
| GetCreationContext
On an entirely different packages github issues post, someone commented with a change to get the correct JS context and sure enough I was able to run node-gyp rebuild
within the node-postal directory to rebind it and the errors went away
Within parser.cc and expand.cc change:
v8::Local<v8::Context> context = exports->CreationContext();
to
v8::Local<v8::Context> context = exports->GetCreationContext().ToLocalChecked();
Is there anyway to change the format of the address being returned by the parser? For example when an address is parsed I get back an array looking like this:
[ { value: '8809', component: 'house_number' },
{ value: 'madison ave', component: 'road' },
{ value: 'cleveland', component: 'city' },
{ value: 'oh', component: 'state' },
{ value: '44102-2738', component: 'postcode' },
{ value: 'usa', component: 'country' } ]
[ { value: '2511', component: 'house_number' },
{ value: 'w genesee st', component: 'road' },
{ value: 'syracuse', component: 'city' },
{ value: 'ny', component: 'state' },
{ value: '13219-1549', component: 'postcode' },
{ value: 'usa', component: 'country' } ]
This is making it very difficult to reconstruct the address and send it to a database. Is there anyway to format the data like:
house_number: '123',
street: 'Some St'
city: 'CA'
postalcode: '12345'
Thanks for the great package.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.