Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trouble installing on Win Server 2012 #202

Closed
dstrawberrygirl opened this issue Jan 8, 2014 · 31 comments
Closed

Trouble installing on Win Server 2012 #202

dstrawberrygirl opened this issue Jan 8, 2014 · 31 comments
Assignees

Comments

@dstrawberrygirl
Copy link

I've downloaded Mapnik v2.2.0 SDK and have VC++ 2008, 2010 and 2012 now installed on my server. The Mapnik demos work without issues, but when I try installing node-mapnik (npm install mapnik on the command line) I get errors during node-gyp rebuild compiling one of the files. The first few errors are as follows:

..\src\mapnik_palette.cpp(90): error C2079: 'str' uses undefined class 'std::ba
sic_ostringstream<_Elem,_Traits,_Alloc>' [c:\Tools\node_modules\mapnik\build_m
apnik.vcxproj]
with
[
_Elem=char,
_Traits=std::char_traits,
_Alloc=std::allocator
]
..\src\mapnik_palette.cpp(90): error C2440: 'initializing' : cannot convert fro
m 'const char [1]' to 'int' [c:\Tools\node_modules\mapnik\build_mapnik.vcxproj
]
There is no context in which this conversion is possible
..\src\mapnik_palette.cpp(91): error C2297: '<<' : illegal, right operand has t
ype 'const char [10]' [c:\Tools\node_modules\mapnik\build_mapnik.vcxproj]

(Similar errors continue throughout the rest of that script, I can provide the whole console output if needed).

The rest of the source seems to compile with just warnings, but when mapnik_palette.cpp appears in the list I get a slew of red. I'm hoping it's something simple.

Any advice would be very much appreciated.

Thanks,
Chris

@springmeyer
Copy link
Member

Hi @dstrawberrygirl - thanks for the report. What node-mapnik are you trying to build? Can you make sure you are using the latest release: v1.2.3? My hunch is that what you are hitting was fixed in dd8c929#diff-71e2bf615b78255a0b69da384a16851d

@springmeyer
Copy link
Member

I'll add that I see now you are just running npm install mapnik. That is unlikely to work on windows due to the hardcoding here: https://github.com/mapnik/node-mapnik/blob/master/binding.gyp#L9-L11 (sorry).

So what I recommend is to:

  1. Checkout from github
git clone https://github.com/mapnik/node-mapnik.git
cd node-mapnik
  1. Edit protobuf paths in binding.gyp

  2. Edit the node-gyp common.gypi

It is located at "~.node-gyp\NODE_VERSION\common.gypi"

  • Change all instances of ExceptionHandling and RuntimeTypeInfo and RuntimeLibrary to:
    'VCCLCompilerTool': {
                'ExceptionHandling': 1,
                'RuntimeTypeInfo':'true',
                'RuntimeLibrary': '2'  # /MD http://stackoverflow.com/questions/757418/should-i-compile-with-md-or-mt
            }

The reason is that these overrides are not working (last I checked):

'VCCLCompilerTool': {

  1. Then try building
  • Ensure Python 27 is on your path
  • You may need to put GDAL_DATA and PROJ_LIB on your path:

Run npm install

set PROJ_LIB=C:\mapnik-v2.2.0\share\proj
set GDAL_DATA=C:\mapnik-v2.2.0\share\gdal

@dstrawberrygirl
Copy link
Author

That sounds very promising! I just saw the npm install was grabbing 0.7.25 and was about to reply when I saw your latest message.

I'll grab from github and give this a go as soon as I can, thanks!

@springmeyer
Copy link
Member

npm install was grabbing 0.7.25

Oh, odd. That is my fault. Should be fixed now since I just tagged a new v1.x series. The gocha is that 1.x requires libprotobuf (which v0.7.x does not). Pretty sure I packageds libprotobuf with the Mapnik v2.2.0 SDK, but if not here are build instructions: https://github.com/mapnik/mapnik-packaging/blob/master/windows/building_mapnik_dependencies.md#protobuf

@dstrawberrygirl
Copy link
Author

I'm still having no luck with the npm install so I've tried to do the manual process of compiling all prerequisites, but after a day of working slowly through the list I'm just hitting more and more errors, each taking significant time to resolve. I got as far as libpq - nmake /f win32.mak resulted in numerous missing file errors, and I have left it at that.

Is there a more simple way to achieve this? Is there just a folder of files I can put on a server without having to rebuild everything?

@springmeyer
Copy link
Member

Ooof, sorry. The idea is that you should be able to compile node-mapnik against the Mapnik v2.2.0 Windows SDK mentioned at http://mapnik.org/download/ which includes all key deps. All you should need to your compiler toolchain ready.

If that is not easy to get working, let me know and I can post a binary of node-mapnik that works with Mapnik v2.2.0 and visual studio 2010 early next week.

@ghost ghost assigned springmeyer Jan 11, 2014
@wilhelmberg
Copy link
Contributor

+1 for a binary of node-mapnik.

@springmeyer
Copy link
Member

@BergWerkGIS It will be 32 only bit for now - that work?

@springmeyer
Copy link
Member

@BergWerkGIS also, in relation to your error at http://gis.stackexchange.com/questions/81539/install-node-mapnik-on-windows, what VS Studio C++ compiler version are you using?

@wilhelmberg
Copy link
Contributor

@springmeyer Sure, anything that would get me up and running on Windows would be great.

Good point about VS version: On the first machine I tried, 2008, 2010, 2012 and 2013, but I haven't checked which version was actually used.
On the second machine (fresh VM) VS 2010 only.

@wilhelmberg
Copy link
Contributor

By removing HAVE_CAIRO (I only need vector data, no bitmap rendering) from c:\mapnik-v2.2.0\bin\mapnik-config.bat the compilation seems to work fine - no errors.
But npm test shows 10 failed tests (see below).
All related to projection issues.

c:\mapnik-v2.2.0\lib\proj.dll is in my path and I've even installed the node proj4 package.
Same errors occur.
Any idea what could be wrong?

 183 passing (7s)
  10 failing

  1) mapnik.Projection  should initialize properly:
     Error: failed to initialize projection with: '+init=epsg:4326'

  2) mapnik.ProjTransform  should initialize properly:
     Error: failed to initialize projection with: '+init=epsg:4326'

  3) mapnik.ProjTransform  should forward coords properly (no-op):
     Error: failed to initialize projection with: '+init=epsg:4326'

  4) mapnik.ProjTransform  should forward coords properly (no-op):
     Error: failed to initialize projection with: '+init=epsg:4326'

  5) mapnik.ProjTransform  should forward coords properly (4326 -> 3857):
     Error: failed to initialize projection with: '+init=epsg:4326'

  6) mapnik.ProjTransform  should backward coords properly (3857 -> 4326):
     Error: failed to initialize projection with: '+init=epsg:4326'

  7) mapnik.ProjTransform  should forward bbox properly (4326 -> 3857):
     Error: failed to initialize projection with: '+init=epsg:4326'

  8) mapnik.ProjTransform  should backward bbox properly (3857 -> 4326):
     Error: failed to initialize projection with: '+init=epsg:4326'

  9) mapnik.VectorTile  should be able to get tile info as various flavors of GeoJSON:
     Error: failed to initialize projection with: '+init=epsg:4326'

  10) mapnik.VectorTile  should be able to query features from vector tile:
     Error: failed to initialize projection with: '+init=epsg:4326'

@springmeyer
Copy link
Member

@BergWerkGIS - great work. Can you add the HAVE_CAIRO back and let me know the exact errors you hit again? Regarding the proj4 init errors this is because you need to set PROJ_LIB to the path to where the proj4 epsg files are. They should be bundled with the Mapnik v2.2.0 SDK, but if I forget them then you can also grab them from the nad download from proj4 site.

@wilhelmberg
Copy link
Contributor

After SET PROJ_LIB=C:\mapnik-v2.2.0\share\proj all tests are successfull.
But it is not possible to have a shapefile as datasource (see my setup after the error messages).

Error messages, when adding back HAVE_CAIRO:

..\src\mapnik_vector_tile.cpp(41): fatal error C1083: Cannot open include file: 'cairo-svg.h': No such file or directory [C:\dev2\ node-mapnik\build\mapnik.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: `C:\Windows\Microsoft.NET\Framework\v4.0.30319\msbuild.exe` failed with exit code: 1
gyp ERR! stack     at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_modules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:789:12)
gyp ERR! System Windows_NT 6.1.7601
gyp ERR! command "node" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild" "--fallback-to-build"
gyp ERR! cwd C:\dev2\node-mapnik
gyp ERR! node -v v0.10.24
gyp ERR! node-gyp -v v0.12.1
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd rebuild --fallback-to-build' (1)
node-pre-gyp ERR! stack     at ChildProcess.<anonymous> (C:\dev2\node-mapnik\node_modules\node-pre-gyp\lib\util\compile.js:31:29)
node-pre-gyp ERR! stack     at ChildProcess.EventEmitter.emit (events.js:98:17)
node-pre-gyp ERR! stack     at maybeClose (child_process.js:735:16)
node-pre-gyp ERR! stack     at Process.ChildProcess._handle.onexit (child_process.js:802:5)
node-pre-gyp ERR! System Windows_NT 6.1.7601
node-pre-gyp ERR! command "node" "C:\\dev2\\node-mapnik\\node_modules\\node-pre-gyp\\bin\\node-pre-gyp" "install" "--fallback-to-build"
node-pre-gyp ERR! cwd C:\dev2\node-mapnik
node-pre-gyp ERR! node -v v0.10.24
node-pre-gyp ERR! node-pre-gyp -v v0.4.1
node-pre-gyp ERR! not ok

npm ERR! [email protected] install: `node-pre-gyp install --fallback-to-build`
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 mapnik package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR!     npm owner ls mapnik
npm ERR! There is likely additional logging output above.
npm ERR! System Windows_NT 6.1.7601
npm ERR! command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--build-from-source"
npm ERR! cwd C:\dev2\node-mapnik
npm ERR! node -v v0.10.24
npm ERR! npm -v 1.3.21
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR!     C:\dev2\node-mapnik\npm-debug.log
npm ERR! not ok code 0

C:\dev2\node-mapnik\npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files (x86)\\nodejs\\\\node.exe',
1 verbose cli   'C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'install',
1 verbose cli   '--build-from-source' ]
2 info using [email protected]
3 info using [email protected]
4 verbose node symlink C:\Program Files (x86)\nodejs\\node.exe
5 verbose readDependencies using package.json deps
6 verbose install where, deps [ 'C:\\dev2\\node-mapnik',
6 verbose install   [ 'node-pre-gyp',
6 verbose install     'mapnik-vector-tile',
6 verbose install     'sphericalmercator',
6 verbose install     'mocha' ] ]
7 info preinstall [email protected]
8 verbose readDependencies using package.json deps
9 verbose already installed skipping node-pre-gyp@https://github.com/springmeyer/node-pre-gyp/tarball/master C:\dev2\node-mapnik
10 verbose already installed skipping mapnik-vector-tile@~0.3.4 C:\dev2\node-mapnik
11 verbose already installed skipping sphericalmercator@~1.0.2 C:\dev2\node-mapnik
12 verbose already installed skipping mocha@~1.15.1 C:\dev2\node-mapnik
13 silly resolved []
14 info build C:\dev2\node-mapnik
15 verbose linkStuff [ false, false, false, 'C:\\dev2' ]
16 info linkStuff [email protected]
17 verbose linkBins [email protected]
18 verbose linkMans [email protected]
19 verbose rebuildBundles [email protected]
20 verbose rebuildBundles [ '.bin',
20 verbose rebuildBundles   'mapnik-vector-tile',
20 verbose rebuildBundles   'mocha',
20 verbose rebuildBundles   'node-pre-gyp',
20 verbose rebuildBundles   'proj4',
20 verbose rebuildBundles   'sphericalmercator' ]
21 verbose rebuild bundle C:\dev2\node-mapnik\node_modules\node-pre-gyp
22 info build C:\dev2\node-mapnik\node_modules\node-pre-gyp
23 info preinstall [email protected]
24 verbose linkStuff [ false, false, false, 'C:\\dev2\\node-mapnik\\node_modules' ]
25 info linkStuff [email protected]
26 verbose linkBins [email protected]
27 verbose link bins [ { 'node-pre-gyp': './bin/node-pre-gyp' },
27 verbose link bins   'C:\\dev2\\node-mapnik\\node_modules\\.bin',
27 verbose link bins   false ]
28 verbose linkMans [email protected]
29 verbose rebuildBundles [email protected]
30 verbose rebuildBundles [ '.bin',
30 verbose rebuildBundles   'aws-sdk',
30 verbose rebuildBundles   'mkdirp',
30 verbose rebuildBundles   'nopt',
30 verbose rebuildBundles   'npmlog',
30 verbose rebuildBundles   'rc',
30 verbose rebuildBundles   'request',
30 verbose rebuildBundles   'rimraf',
30 verbose rebuildBundles   'semver',
30 verbose rebuildBundles   'tar',
30 verbose rebuildBundles   'tar-pack' ]
31 info install [email protected]
32 info postinstall [email protected]
33 verbose rebuild bundle C:\dev2\node-mapnik\node_modules\proj4
34 info build C:\dev2\node-mapnik\node_modules\proj4
35 info preinstall [email protected]
36 verbose linkStuff [ false, false, false, 'C:\\dev2\\node-mapnik\\node_modules' ]
37 info linkStuff [email protected]
38 verbose linkBins [email protected]
39 verbose linkMans [email protected]
40 verbose rebuildBundles [email protected]
41 verbose rebuildBundles [ 'mgrs' ]
42 info install [email protected]
43 info postinstall [email protected]
44 info install [email protected]
45 verbose unsafe-perm in lifecycle true
46 info [email protected] Failed to exec install script
47 error [email protected] install: `node-pre-gyp install --fallback-to-build`
47 error Exit status 1
48 error Failed at the [email protected] install script.
48 error This is most likely a problem with the mapnik package,
48 error not with npm itself.
48 error Tell the author that this fails on your system:
48 error     node-pre-gyp install --fallback-to-build
48 error You can get their info via:
48 error     npm owner ls mapnik
48 error There is likely additional logging output above.
49 error System Windows_NT 6.1.7601
50 error command "C:\\Program Files (x86)\\nodejs\\\\node.exe" "C:\\Program Files (x86)\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install" "--build-from-source"
51 error cwd C:\dev2\node-mapnik
52 error node -v v0.10.24
53 error npm -v 1.3.21
54 error code ELIFECYCLE
55 verbose exit [ 1, true ]

Error, when I try to use a shapefile as datasource:

Error: Could not create datasource for type: 'shape'  encountered during parsing of layer 'wien' in Layer at line 12 of 'wien.xml'

index.js:

var mapnik = require('./node-mapnik');
var map = new mapnik.Map(256,256);
map.load('wien.xml', function(err, map){
    if(err){console.log(err); return;}
    console.log(map);
});

wien.xml:

<?xml version="1.0" encoding="utf-8"?>
<Map srs="+init=epsg:3857" background-color="steelblue">
<Parameters>
  <Parameter name="bounds">-180,-85.0511,180,85.0511</Parameter>
  <Parameter name="center">0,0,2</Parameter>
  <Parameter name="minzoom">0</Parameter>
  <Parameter name="maxzoom">8</Parameter>
</Parameters>
<Layer name="wien" srs="+init=epsg:3857">
    <Datasource>
        <Parameter name="file">c:/megapolyshp/baublock</Parameter>
        <Parameter name="type">shape</Parameter>
    </Datasource>
</Layer>
</Map>

Contents of C:\mapnik-v2.2.0\lib\mapnik\input:

csv.input
gdal.input
geojson.input
ogr.input
postgis.input
raster.input
shape.input
sqlite.input

Any idea what's missing?

@springmeyer
Copy link
Member

If you are using node-mapnik master, I removed auto-plugin registration, so you need mapnik.register_datasource(path.join(mapnik.settings.paths.input_plugins,'shape.input'));

@wilhelmberg
Copy link
Contributor

Oh yeah! That did it. Finally back to VS2013 and NodeTools for VS.

Thanks!

@springmeyer
Copy link
Member

@BergWerkGIS - that is great news. I'm still planning binaries, but have not found the time. In fact, I'm curious whether you might be interesting in taking on producing binaries. I could mentor you through the steps needed. It would basically be 1) learning node-pre-gyp, 2) drafting up a script to build node-mapnik against a few different node versions like is done here, and 3) a quick .bat to copy all dependent libraries (and input plugins, etc) into ./lib/binding.

@wilhelmberg
Copy link
Contributor

@springmeyer
Sure, I could give it a shot.
You can contact me via the email address on my profile page and we schedule something next week.
If that's ok with you.

@wilhelmberg
Copy link
Contributor

@springmeyer
Had some unexpected free hours today, so I tried on my own:

  • from cairo/src I copied cairo-svg-surface.c, cairo-svg.h and cairo-svg-surface-private.h to C:\mapnik-v2.2.0\include --> npm install works with HAVE_CAIRO
  • npm install -g node-pre-gyp
  • installed nodist
  • uninstalled exting node.js
  • followed steps in node-sqlite3/scripts/build.bat till npm install --build-from-source, which fails, when trying to install node-pre-gyp (dependency of node-mapnik, cirular reference?).
npm install --build-from-source
npm http GET https://registry.npmjs.org/sphericalmercator
npm http GET https://registry.npmjs.org/mapnik-vector-tile
npm http GET https://registry.npmjs.org/mocha
npm http GET https://github.com/springmeyer/node-pre-gyp/tarball/master
npm http 304 https://registry.npmjs.org/mocha
npm http 304 https://registry.npmjs.org/sphericalmercator
npm http 304 https://registry.npmjs.org/mapnik-vector-tile
npm http 200 https://github.com/springmeyer/node-pre-gyp/tarball/master
npm ERR! cb() never called!
npm ERR! not ok code 0

Can you give any hints?

@springmeyer
Copy link
Member

Great progress. The cb() never called error is a node bug in v0.8.x versions than can be triggered when installing packages from git urls. So I think to workaround we should modify the node-mapnik package json to actually point to a node-pre-gyp tag so it does not pull from github. Can you try that?

@wilhelmberg
Copy link
Contributor

@springmeyer
I've changed the dependency to "node-pre-gyp": ">= 0.4.1", but it seems to me, that there is some kind of problem with nodist on Windows (or my system in general).
Other packages I've tried give similiar path.resolve or cb() never called errors.

install-node-pre-gyp

npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ 'node.exe',
1 verbose cli   'c:\\dev2\\nodist\\bin\\node_modules\\npm\\cli.js',
1 verbose cli   'install',
1 verbose cli   'node-pre-gyp',
1 verbose cli   '-g' ]
2 info using [email protected]
3 info using [email protected]
4 verbose read json c:\dev2\nodist\bin\package.json
5 verbose read json c:\dev2\nodist\bin\package.json
6 verbose cache add [ 'node-pre-gyp', null ]
7 silly cache add name=undefined spec="node-pre-gyp" args=["node-pre-gyp",null]
8 verbose parsed url { protocol: null,
8 verbose parsed url   slashes: null,
8 verbose parsed url   auth: null,
8 verbose parsed url   host: null,
8 verbose parsed url   port: null,
8 verbose parsed url   hostname: null,
8 verbose parsed url   hash: null,
8 verbose parsed url   search: null,
8 verbose parsed url   query: null,
8 verbose parsed url   pathname: 'node-pre-gyp',
8 verbose parsed url   path: 'node-pre-gyp',
8 verbose parsed url   href: 'node-pre-gyp' }
9 silly lockFile dd9a4839-node-pre-gyp node-pre-gyp
10 verbose lock node-pre-gyp C:\Users\bergw\AppData\Roaming\npm-cache\dd9a4839-node-pre-gyp.lock
11 silly lockFile dd9a4839-node-pre-gyp node-pre-gyp
12 verbose addNamed [ 'node-pre-gyp', '' ]
13 verbose addNamed [ null, '' ]
14 silly lockFile a727988c-node-pre-gyp node-pre-gyp@
15 verbose lock node-pre-gyp@ C:\Users\bergw\AppData\Roaming\npm-cache\a727988c-node-pre-gyp.lock
16 silly addNameRange { name: 'node-pre-gyp', range: '', hasData: false }
17 verbose url raw node-pre-gyp
18 verbose url resolving [ 'https://registry.npmjs.org/', './node-pre-gyp' ]
19 verbose url resolved https://registry.npmjs.org/node-pre-gyp
20 info trying registry request attempt 1 at 16:21:33
21 verbose etag "65BXBFBAKD3MGO5T5X3OWP8DQ"
22 http GET https://registry.npmjs.org/node-pre-gyp
23 http 304 https://registry.npmjs.org/node-pre-gyp
24 silly registry.get cb [ 304,
24 silly registry.get   { date: 'Sun, 02 Feb 2014 15:21:33 GMT',
24 silly registry.get     server: 'Apache',
24 silly registry.get     connection: 'Keep-Alive',
24 silly registry.get     'keep-alive': 'timeout=10, max=50',
24 silly registry.get     etag: '"65BXBFBAKD3MGO5T5X3OWP8DQ"',
24 silly registry.get     'cache-control': 'max-age=1',
24 silly registry.get     vary: 'Accept' } ]
25 verbose etag node-pre-gyp from cache
26 silly addNameRange number 2 { name: 'node-pre-gyp', range: '', hasData: true }
27 silly addNameRange versions [ 'node-pre-gyp',
27 silly addNameRange   [ '0.1.0',
27 silly addNameRange     '0.1.1',
27 silly addNameRange     '0.1.2',
27 silly addNameRange     '0.1.3',
27 silly addNameRange     '0.1.4',
27 silly addNameRange     '0.1.5',
27 silly addNameRange     '0.1.6',
27 silly addNameRange     '0.1.7',
27 silly addNameRange     '0.1.8',
27 silly addNameRange     '0.1.9',
27 silly addNameRange     '0.2.1',
27 silly addNameRange     '0.2.2',
27 silly addNameRange     '0.2.3',
27 silly addNameRange     '0.2.4',
27 silly addNameRange     '0.2.5',
27 silly addNameRange     '0.2.6',
27 silly addNameRange     '0.3.0',
27 silly addNameRange     '0.3.1',
27 silly addNameRange     '0.3.1-alpha',
27 silly addNameRange     '0.4.0',
27 silly addNameRange     '0.4.1' ] ]
28 verbose addNamed [ 'node-pre-gyp', '0.4.1' ]
29 verbose addNamed [ '0.4.1', '0.4.1' ]
30 silly lockFile 27a3e397-node-pre-gyp-0-4-1 [email protected]
31 verbose lock [email protected] C:\Users\bergw\AppData\Roaming\npm-cache\27a3e397-node-pre-gyp-0-4-1.lock
32 verbose read json C:\Users\bergw\AppData\Roaming\npm-cache\node-pre-gyp\0.4.1\package\package.json
33 silly lockFile 27a3e397-node-pre-gyp-0-4-1 [email protected]
34 silly lockFile a727988c-node-pre-gyp node-pre-gyp@
35 silly resolved [ { name: 'node-pre-gyp',
35 silly resolved     description: 'Node.js native addon binary install tool',
35 silly resolved     version: '0.4.1',
35 silly resolved     keywords: [ 'native', 'addon', 'module', 'c', 'c++', 'bindings', 'binary' ],
35 silly resolved     author: { name: 'Dane Springmeyer', email: '[email protected]' },
35 silly resolved     repository:
35 silly resolved      { type: 'git',
35 silly resolved        url: 'git://github.com/springmeyer/node-pre-gyp.git' },
35 silly resolved     preferGlobal: true,
35 silly resolved     bin: { 'node-pre-gyp': './bin/node-pre-gyp' },
35 silly resolved     main: './lib/node-pre-gyp.js',
35 silly resolved     dependencies:
35 silly resolved      { nopt: '~2.1.2',
35 silly resolved        npmlog: '~0.0.6',
35 silly resolved        request: '2',
35 silly resolved        semver: '~2.1.0',
35 silly resolved        tar: '~0.1.19',
35 silly resolved        'tar-pack': '~2.0.0',
35 silly resolved        mkdirp: '~0.3.5',
35 silly resolved        'aws-sdk': '~2.0.0-rc6',
35 silly resolved        rc: '~0.3.2',
35 silly resolved        rimraf: '~2.2.5' },
35 silly resolved     engines: { node: '>= 0.8.0' },
35 silly resolved     scripts: { test: './test.sh' },
35 silly resolved     readme: '# node-pre-gyp\n\n[![Build Status](https://secure.travis-ci.org/springmeyer/node-pre-gyp.png)](https://travis-ci.org/springmeyer/node-pre-gyp)\n\n`node-pre-gyp` is a Node.js native add-on install tool.\n\n## Does this replace npm or node-gyp?\n\nNo: it plays nicely with them.\n\n - You still publish your package to the npm repository\n - You still create a `binding.gyp` to compile your module with `node-gyp`\n\nWhat `node-pre-gyp` does is stand between `npm` and `node-gyp`.\n\n## Who uses node-pre-gyp?\n\n**Developers** of C++ modules can use `node-pre-gyp` to package and publish the binary `.node` before running `npm publish`.\n\n**Users** can then `npm install` your module from a binary and `node-pre-gyp` does the work to make this seamless.\n\n## Modules using `node-pre-gyp`:\n\n - [node-sqlite3](https://github.com/mapbox/node-sqlite3)\n - [node-mapnik](https://github.com/mapnik/node-mapnik)\n - [node-osmium](https://github.com/osmcode/node-osmium)\n - [node-osrm](https://github.com/DennisOSRM/node-OSRM)\n\nFor more examples see the [test apps](test/).\n\n## Usage\n\n\n**1) Add a custom `install` script to `package.json`**\n\n```js\n    "scripts": {\n        "install": "node-pre-gyp install --fallback-to-build",\n    }\n```\n\n\n**2) Add a `binary` property to `package.json`**\n\nIt must provide these properties:\n\n  - `module_name`: The name of your native node module.\n  - `module_path`: The location your native module is placed after a build. This should be an empty directory without other javascript files.\n  - `remote_uri`: A url to the remote location where you\'ve published tarball binaries\n  - `template`: A string describing the tarball versioning scheme for your binaries\n\nAnd example from `node-sqlite3` looks like:\n\n```js\n"binary": {\n    "module_name": "node_sqlite3",\n    "module_path": "./lib/binding/",\n    "remote_uri": "http://node-sqlite3.s3.amazonaws.com",\n    "template": "{configuration}/{module_name}-v{version}-{node_abi}-{platform}-{arch}.tar.gz"\n}\n```\n\n**3) Add node-pre-gyp as a bundled dependency**\n\n```js\n"dependencies"  : {\n  "node-pre-gyp": "~0.4.0",\n},\n"bundledDependencies":["node-pre-gyp"],\n```\n\n**4) Build and package your app**\n\nInstall node-pre-gyp globally:\n\n    npm install node-pre-gyp\n\nThen build and package your app:\n\n    node-pre-gyp build package\n\n**5) Publish the tarball**\n\nOnce packaged, now you can publish:\n\n    node-pre-gyp publish\n\nCurrently the `publish` command pushes your binary to S3. This requires:\n\n - You have created a bucket already.\n - The `remote-uri` points to an S3 http or https endpoint.\n - You have configured node-pre-gyp to read your S3 credentials (see [S3 hosting](#s3-hosting) for details).\n\nYou can also host your binaries elsewhere. To do this requires:\n\n - You manually publish the binary created by the `package` command.\n - The package is available as a tarball in the `build/stage/` directory.\n - You provide a remote location and point the `remote_uri` value to it.\n\n**6) Automating builds**\n\nNow you need to publish builds for all the platforms and node versions you wish to support. This is best automated. See [Travis Automation](#travis-automation) for how to auto-publish builds on OS X and Linux. On windows consider using a script [like this](https://github.com/mapbox/node-sqlite3/blob/master/scripts/build.bat) to quickly create and publish binaries.\n\n**7) You\'re done!**\n\nNow publish your package to the npm registry. Users will now be able to install your module from a binary. \n\nWhat will happen is this:\n\n1. `npm install <your package>` will pull from the npm registry\n2. npm will run the `install` script which will call out to `node-pre-gyp`\n3. `node-pre-gyp` will fetch the binary `.node` module and unpack in the right place\n4. Assuming that all worked, you are done\n\nIf a failure occurred and `--fallback-to-build` was used then `node-gyp rebuild` will be called to try to source compile the module.\n\n## S3 Hosting\n\nYou can host wherever you choose but S3 is cheap, `node-pre-gyp publish` expects it, and S3 can be integrated well with [travis.ci](http://travis-ci.org) to automate builds for OS X and Ubuntu. Here is an approach to do this:\n\nFirst, get setup locally and test the workflow:\n\n**1) Create an S3 bucket**\n\nAnd have your key and secret key ready for writing to the bucket.\n\n**2) Install node-pre-gyp**\n\nEither install it globally:\n\n    npm install node-pre-gyp -g\n\nOr put the local version on your PATH\n\n    export PATH=`pwd`/node_modules/.bin/:$PATH\n\n**3) Create an `~/.node_pre_gyprc`**\n\nOr pass options in any way supported by [RC](https://github.com/dominictarr/rc#standards)\n\nA `~/.node_pre_gyprc` looks like:\n\n```js\n{\n    "accessKeyId": "xxx",\n    "secretAccessKey": "xxx"\n}\n```\n\nAnother way is to use your environment:\n\n    export node_pre_gyp_accessKeyId=xxx\n    export node_pre_gyp_secretAccessKey=xxx\n\nYou may also need to specify the `region` if it is not explicit in the `remote_uri` value you use. The `bucket` can also be specified but it is optional because `node-pre-gyp` will detect it from the `remote_uri` value.\n\n**4) Package and publish your build**\n\n    node-pre-gyp package publish\n\nNote: if you hit an error like `Hostname/IP doesn\'t match certificate\'s altnames` it may mean that you need to provide the `region` option in your config.\n\n## Travis Automation\n\nTravis can push to S3 after a successful build and supports both:\n\n - Ubuntu Precise and OS X\n - Multiple Node.js versions\n\nThis enables you to cheaply auto-build and auto-publish binaries for (likely) the majority of your users.\n\n**1) Install the travis gem**\n\n    gem install travis\n\n**2) Create secure `global` variables**\n\nMake sure you run this command from within the directory of your module.\n\nUse `travis-encrypt` like:\n\n    travis encrypt node_pre_gyp_accessKeyId=${node_pre_gyp_accessKeyId}\n    travis encrypt node_pre_gyp_secretAccessKey=${node_pre_gyp_secretAccessKey}\n\nThen put those values in your `.travis.yml` like:\n\n```yaml\nenv:\n  global:\n    - secure: F+sEL/v56CzHqmCSSES4pEyC9NeQlkoR0Gs/ZuZxX1ytrj8SKtp3MKqBj7zhIclSdXBz4Ev966Da5ctmcTd410p0b240MV6BVOkLUtkjZJyErMBOkeb8n8yVfSoeMx8RiIhBmIvEn+rlQq+bSFis61/JkE9rxsjkGRZi14hHr4M=\n    - secure: o2nkUQIiABD139XS6L8pxq3XO5gch27hvm/gOdV+dzNKc/s2KomVPWcOyXNxtJGhtecAkABzaW8KHDDi5QL1kNEFx6BxFVMLO8rjFPsMVaBG9Ks6JiDQkkmrGNcnVdxI/6EKTLHTH5WLsz8+J7caDBzvKbEfTux5EamEhxIWgrI=\n```\n\nMore details on travis encryption at http://about.travis-ci.org/docs/user/encryption-keys/.\n\n**3) Hook up publishing**\n\nJust put `node-pre-gyp package publish` in your `.travis.yml` after `npm install`.\n\nIf you want binaries for OS X change your `.travis.yml` to use:\n\n```yml\nlanguage: objective-c\n```\n\nPerhaps keep that change in a different git branch and sync that when you want binaries published.\n\nNote: using `language: objective-c` instead of `language: nodejs` looses node.js specific travis sugar like a matrix for multiple node.js versions.\n\nBut you can replicate the lost behavior by replacing:\n\n```yml\nnode_js:\n  - "0.8"\n  - "0.10"\n```\n\nWith:\n\n```yml\nenv:\n  matrix:\n    - export NODE_VERSION="0.8"\n    - export NODE_VERSION="0.10"\n\nbefore_install:\n - git clone https://github.com/creationix/nvm.git ./.nvm\n - source ./.nvm/nvm.sh\n - nvm install $NODE_VERSION\n - nvm use $NODE_VERSION\n```\n\n**4) Publish when you want**\n\nYou might wish to publish binaries only on a specific commit. To do this you could borrow from the [travis.ci idea of commit keywords](http://about.travis-ci.org/docs/user/how-to-skip-a-build/) and add special handling for commit messages with `[publish]`:\n\n    COMMIT_MESSAGE=$(git show -s --format=%B $TRAVIS_COMMIT | tr -d \'\\n\')\n    if test "${COMMIT_MESSAGE#*\'[publish]\'}" != "$COMMIT_MESSAGE"; then node-pre-gyp publish; fi;\n\nOr you could automatically detect if the git branch is a tag:\n\n    if [[ $TRAVIS_BRANCH == `git describe --tags --always HEAD` ]] ; then node-pre-gyp publish; fi\n\nRemember this publishing is not the same as `npm publish`. We\'re just talking about the\nbinary module here and not your entire npm package. To automate the publishing of your entire package to npm on travis see http://about.travis-ci.org/docs/user/deployment/npm/\n\n### Commands\n\nView all possible commands:\n\n    node-pre-gyp --help\n\n\n#### List published binaries\n\n    node-pre-gyp info\n\n#### Unpublish binaries\n\n    node-pre-gyp unpublish\n\n#### Clean install and build artifacts\n\n    node-pre-gyp clean\n\n#### Clean and install\n\n    node-pre-gyp reinstall # runs "clean" and "install"\n\n#### Chaining commands\n\n    node-pre-gyp clean build unpublish publish info\n\n### Options\n\nOptions include:\n\n - `-C/--directory`: run the command in this directory\n - `--build-from-source`: build from source instead of using pre-built binary\n - `--fallback-to-build`: fallback to building from source if pre-built binary is not available\n\nBoth `--build-from-source` and `--fallback-to-build` can be passed alone or they can provide values. So, in addition to being able to pass `--build-from-source` you can also pass `--build-from-source=myapp` where `myapp` is the name of your module.\n\nFor example: `npm install --build-from-source=myapp`. This is useful if:\n\n - `myapp` is referenced in the package.json of a larger app and therefore `myapp` is being installed as a dependent with `npm install`.\n - The larger app also depends on other modules installed with `node-pre-gyp`\n - You only want to trigger a source compile for `myapp` and the other modules.\n',
35 silly resolved     readmeFilename: 'README.md',
35 silly resolved     _id: '[email protected]',
35 silly resolved     _from: 'node-pre-gyp' } ]
36 info install [email protected] into c:\dev2\nodist\bin
37 info installOne [email protected]
38 error TypeError: Arguments to path.resolve must be strings
38 error     at Object.exports.resolve (path.js:116:15)
38 error     at Object.exports.relative (path.js:239:20)
38 error     at installOne_ (c:\dev2\nodist\bin\node_modules\npm\lib\install.js:693:26)
38 error     at installOne (c:\dev2\nodist\bin\node_modules\npm\lib\install.js:621:3)
38 error     at c:\dev2\nodist\bin\node_modules\npm\lib\install.js:508:9
38 error     at c:\dev2\nodist\bin\node_modules\npm\node_modules\slide\lib\async-map.js:54:35
38 error     at Array.forEach (native)
38 error     at c:\dev2\nodist\bin\node_modules\npm\node_modules\slide\lib\async-map.js:54:11
38 error     at Array.forEach (native)
38 error     at asyncMap (c:\dev2\nodist\bin\node_modules\npm\node_modules\slide\lib\async-map.js:53:8)
39 error If you need help, you may report this log at:
39 error     <http://github.com/isaacs/npm/issues>
39 error or email it to:
39 error     <[email protected]>
40 error System Windows_NT 6.1.7601
41 error command "node.exe" "c:\\dev2\\nodist\\bin\\node_modules\\npm\\cli.js" "install" "node-pre-gyp" "-g"
42 error cwd C:\Users\bergw\_TEMP\binarybranch\node-mapnik
43 error node -v v0.10.25
44 error npm -v 1.1.68
45 verbose exit [ 1, true ]

@springmeyer
Copy link
Member

Hmm. I think you are right. Maybe try upgrading to the latest npm while sticking with the modiste version of node itself. So the trick will be to override nodists version of npm.

@wilhelmberg
Copy link
Contributor

@springmeyer
Yes, that did it (updating npm).
Now it works, even with: "node-pre-gyp": "https://github.com/springmeyer/node-pre-gyp/tarball/master".

x64 build does not work, but I suppose you suspected that already (since mapnik sdk is x86):

mapnik.lib(mapnik.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x6 4' [C:\Users\bergw\_TEMP\binarybranch\node-mapnik\build\mapnik.vcxproj]

Which additional files would be needed for step 3): "a quick .bat to copy all dependent libraries (and input plugins, etc) into ./lib/binding"?

@springmeyer
Copy link
Member

Great that upgrading npm fixed this!

Regarding 64 bit Mapnik. Right, the existing SDK only comes as 32 bit. We really need to provide a 64 bit one. Maybe this is also something you would be capable of working on? How about we catch up through LinkedIn on this. I am free on Tuesday, so will be in touch.

Regarding step 3. I think all the dependent libs in the SDK lib folder will be needed. If they are dropped in the same directory as the 'mapnik.node' module then the build should be portable across systems. As far as input plugins these also need to be copied but can be anywhere, they just need to be referenced with a relative path in the 'mapnik_settings.js'. I think my scripts to do this on windows love in the tilemill/platforms/windows/package.bat but I'll need to check on Monday. The node-Mapnik/scripts directory has a work in progress scripts like this for Linux and osx.

On Feb 2, 2014, at 10:25 AM, Wilhelm Berg [email protected] wrote:

@springmeyer
Yes, that did it (updating npm).
Now it works, even with: "node-pre-gyp": "https://github.com/springmeyer/node-pre-gyp/tarball/master".

x64 build does not work, but I suppose you suspected that already (since mapnik sdk is x86):

mapnik.lib(mapnik.dll) : fatal error LNK1112: module machine type 'X86' conflicts with target machine type 'x6 4' [C:\Users\bergw_TEMP\binarybranch\node-mapnik\build\mapnik.vcxproj]
Which additional files would be needed for step 3): "a quick .bat to copy all dependent libraries (and input plugins, etc) into ./lib/binding"?


Reply to this email directly or view it on GitHub.

@clns
Copy link

clns commented Apr 1, 2014

Is there any new info on this? I'm also struggling with installing node-mapnik on Windows 8.1. I was able to successfully run the c++ and python mapnik demos, so all the paths are correctly set up. I'm using python 2.7 32bit. Also I have protobuf compiled at C:\dev2\protobuf, so includes path is C:\dev2\protobuf\vsprojects\include and library path is C:\dev2\protobuf\vsprojects\Release. This should be the same as the hard-coded paths in binding.gyp.

When I run npm install mapnik I get the following output, and I'm not sure if it's the same error as above. I'm pretty much stuck right now. Any help would be much appreciated!

...
> [email protected] install C:\Users\Calin\node_modules\mapnik
> node-pre-gyp install --fallback-to-build

node-pre-gyp http GET https://node-mapnik.s3-us-west-1.amazonaws.com/v1.4.0/mapnik-v1.4.0-node-v11-win32-ia32.tar.gz
node-pre-gyp http 404 https://node-mapnik.s3-us-west-1.amazonaws.com/v1.4.0/mapnik-v1.4.0-node-v11-win32-ia32.tar.gz
node-pre-gyp ERR! Source compile required: 404 status code downloading tarball

C:\Users\Calin\AppData\Roaming\npm\node_modules\mapnik>node "C:\Program Files (x
86)\nodejs\node_modules\npm\bin\node-gyp-bin....\node_modules\node-gyp\bin\no
de-gyp.js" rebuild --fallback-to-build
Building the projects in this solution one at a time. To enable parallel build,
please add the "/m" switch.
generate_protoc_files
./node_modules/mapnik-vector-tile/proto/ : warning : directory does not exist.
[C:\Users\Calin\AppData\Roaming\npm\node_modules\mapnik\build\action_before_bui
ld.vcxproj]
..\node_modules\mapnik-vector-tile\proto\vector_tile.proto: File does not res
ide within any path specified using --proto_path (or -I). You must specify a
--proto_path which encompasses this file. Note that the proto_path must be
an exact prefix of the .proto file names -- protoc is too dumb to figure out
when two paths (e.g. absolute and relative) are equivalent (it's harder than
you think).
C:\Program Files (x86)\MSBuild\Microsoft.Cpp\v4.0\Microsoft.CppCommon.targets(1
51,5): error MSB6006: "cmd.exe" exited with code 1. [C:\Users\Calin\AppData\Roa
ming\npm\node_modules\mapnik\build\action_before_build.vcxproj]
gyp ERR! build error
gyp ERR! stack Error: C:\Program Files (x86)\MSBuild\12.0\bin\msbuild.exe fail
ed with exit code: 1
gyp ERR! stack at ChildProcess.onExit (C:\Program Files (x86)\nodejs\node_mo
dules\npm\node_modules\node-gyp\lib\build.js:267:23)
gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
gyp ERR! stack at Process.ChildProcess._handle.onexit (child_process.js:797:
12)
gyp ERR! System Windows_NT 6.2.9200
gyp ERR! command "node" "C:\Program Files (x86)\nodejs\node_modules\npm\nod
e_modules\node-gyp\bin\node-gyp.js" "rebuild" "--fallback-to-build"
gyp ERR! cwd C:\Users\Calin\AppData\Roaming\npm\node_modules\mapnik
gyp ERR! node -v v0.10.26
gyp ERR! node-gyp -v v0.12.2
gyp ERR! not ok
node-pre-gyp ERR! build error
node-pre-gyp ERR! stack Error: Failed to execute 'node-gyp.cmd rebuild --fallbac
k-to-build' (1)
node-pre-gyp ERR! stack at ChildProcess. (C:\Users\Calin\AppData
Roaming\npm\node_modules\mapnik\node_modules\node-pre-gyp\lib\util\compile.js:34
:29)
node-pre-gyp ERR! stack at ChildProcess.EventEmitter.emit (events.js:98:17)
node-pre-gyp ERR! stack at maybeClose (child_process.js:743:16)
node-pre-gyp ERR! stack at Process.ChildProcess.handle.onexit (child_proces
s.js:810:5)
node-pre-gyp ERR! System Windows_NT 6.2.9200
node-pre-gyp ERR! command "node" "C:\Users\Calin\AppData\Roaming\npm\node

modules\mapnik\node_modules\node-pre-gyp\bin\node-pre-gyp" "install" "--fal
lback-to-build"
node-pre-gyp ERR! cwd C:\Users\Calin\AppData\Roaming\npm\node_modules\mapnik
node-pre-gyp ERR! node -v v0.10.26
node-pre-gyp ERR! node-pre-gyp -v v0.4.2
node-pre-gyp ERR! not ok
npm ERR! [email protected] install: node-pre-gyp install --fallback-to-build
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 mapnik package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! node-pre-gyp install --fallback-to-build
npm ERR! You can get their info via:
npm ERR! npm owner ls mapnik
npm ERR! There is likely additional logging output above.

npm ERR! System Windows_NT 6.2.9200
npm ERR! command "C:\Program Files (x86)\nodejs\node.exe" "C:\Program File
s (x86)\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "mapnik"
npm ERR! cwd c:\dev2
npm ERR! node -v v0.10.26
npm ERR! npm -v 1.4.3
npm ERR! code ELIFECYCLE
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! c:\dev2\npm-debug.log
npm ERR! not ok code 0

image

@springmeyer
Copy link
Member

hi @calin-s - nice job making it this far. We are very close to providing official binaries for windows - at most a week or so away. That said the problem you are encountering is a result of a workaround for a bug in the binding.gyp logic on windows. Right now the path to the node_modules/mapnik-vector-tile/proto folder is hardcoded after #225. So, you best best is to git clone node-mapnik into C:/dev2/node-mapnik and then change into that directory and run npm install.

@clns
Copy link

clns commented Apr 1, 2014

hey @springmeyer thanks for the encouragement, I was starting to feel very stupid. I'm up and running now, thanks!!

One quick, unrelated question: my best bet for learning how to use it is, I guess, to check out the tests and sample code (https://github.com/mapnik/node-mapnik/blob/master/test and https://github.com/mapnik/node-mapnik-sample-code), since there isn't any API site with the exact methods you can use, right? And considering that I would like to skip python for now because I'm only trying to render some PostGIS data into a slippy map, and node.js is something I'm more familiar with.

@springmeyer
Copy link
Member

@calin-s great you got things working. Correct on learning resources. But I plan to write API docs: #235. The bindings are robust and supported - definitely a solid replacement to python, but yeah, I need to write some docs. If you get inspired as you learn feel free to add the https://github.com/mapnik/node-mapnik/wiki/API and ask me questions if you need help.

@clns
Copy link

clns commented Apr 2, 2014

@springmeyer nice, I'll go for it, and try to contribute to the API if I can. I suppose you're preferred contact method is by email, so I'll do that if absolutely necessary :)

@springmeyer
Copy link
Member

My preferred method actually is github issues.

@clns
Copy link

clns commented Apr 2, 2014

Ok thanks.

@springmeyer
Copy link
Member

yay, as of node-mapnik 1.4.8 we are now officially providing windows binaries - updated docs in 59d4a9f.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants