node-postal icon indicating copy to clipboard operation
node-postal copied to clipboard

Node Bindings

Open mishra123 opened this issue 7 years ago • 9 comments

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?

mishra123 avatar Feb 08 '18 22:02 mishra123

node-postal has only been tested on Mac and Linux, not Windows. Support for Windows was only recently added in the libpostal C library (has to be compiled with MSYS2), but not sure if node-postal would work unmodified. If you get it working, please feel free to make a pull request. Otherwise it's best to use a Linux VM or container if possible.

albarrentine avatar Feb 08 '18 23:02 albarrentine

Now, I am doing it on Amazon EC2 Linux. when I run "npm install openevenues/libpostal", it gave me the following error:

[email protected] install /home/ec2-user/libpostal/node_modules/node-postal (node-gyp rebuild) || (exit 0)

make: Entering directory /home/ec2-user/libpostal/node_modules/node-postal/build' CXX(target) Release/obj.target/expand/src/expand.o ../src/expand.cc:1:33: fatal error: libpostal/libpostal.h: No such file or directory #include <libpostal/libpostal.h> ^ compilation terminated. make: *** [Release/obj.target/expand/src/expand.o] Error 1 make: Leaving directory /home/ec2-user/libpostal/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 (/usr/local/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.9.38-16.35.amzn1.x86_64 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 /home/ec2-user/libpostal/node_modules/node-postal gyp ERR! node -v v4.6.0 gyp ERR! node-gyp -v v3.4.0 gyp ERR! not ok [email protected] node_modules/node-postal âââ [email protected] âââ [email protected]

How shall I resolve this?

mishra123 avatar Feb 09 '18 02:02 mishra123

Make sure to install libpostal first, as mentioned in the README. It’s not currently possible to install node-postal with one command. The C library needs to be installed separately.

albarrentine avatar Feb 09 '18 06:02 albarrentine

Yeah I have installed libpostal on EC2 before setting up node-postal. I have followed the following steps:

  1. sudo yum install curl autoconf automake libtool pkgconfig
  2. git clone https://github.com/openvenues/libpostal cd libpostal ./bootstrap.sh ./configure --datadir=[...some dir with a few GB of space...] make -j4 sudo make install

sudo ldconfig

  1. sudo npm install -g node-gyp

  2. npm install openvenues/node-postal - This is the step where the error in the previous post was occurred.

I am actually setting up AWS Lambda with node-libpostal. I am deploying the executables from EC2 on to S3 bucket which will be executed by Lambda. But I cannot go any further as I am stuck with step 4 above. Please help me with this.

mishra123 avatar Feb 10 '18 03:02 mishra123

Hi @mishra123 , Were you able to find a solution for running the libpostal in AWS lambda?

nk-gears avatar Oct 01 '18 12:10 nk-gears

Hi @mishra123 , I too am interested in hearing about your efforts in deploying libpostal onto AWS Lambda.

RayRenteria avatar Nov 08 '19 22:11 RayRenteria

Hello all -- I stumbled upon this while trying to deploy a Lambda function that uses pypostal and just wanted to chime in (with some bad news). It appears to me that, it's not going to be possible to deploy code that uses libpostal to AWS Lambda, barring something I'm missing or not understanding. This is given that Lambda's 250MB cap for deployment packages (including function code and all layers) and that libpostal appears to blow up if the data directory is not present. In my testing, I see my data directory taking up almost 2GB.

I would love to be proven wrong here! If anyone out there has any tips for working around this, I am all ears.

danielmklein avatar May 08 '20 19:05 danielmklein

With the new EFS and Fargate integration, this should at least be possible now - whether you'd want the data dir effectively NFS mounted is another story alltogether though....

bonespiked avatar Jul 06 '20 16:07 bonespiked

With the new EFS and Fargate integration, this should at least be possible now - whether you'd want the data dir effectively NFS mounted is another story alltogether though....

Could you elaborate a bit on this?

CaseGuide avatar Aug 04 '20 15:08 CaseGuide