Can't run node module geojson-polygon-labels on Windows - node.js

I've download the package from "https://github.com/andrewharvey/geojson-polygon-labels/", ran "npm-install" and the node-modules folder was successfully created:
folder - screenshot
However, when cd to bin folder and run "geojson-polygon-labels < v.geojson > v_label.geojson", it throws the eror: "not recognized as internal or external command, operable program or batch file".
I'm really confused at this point. On github it's not really well-documented how to use this tool, and I'm quite new to Node too.
Please help me. Thanks!
Edit: I've tried install it on Ubuntu (subsystem on Windows 10) then run "geojson-polygon-labels" from the bin folder. The same error occured.
Edit2: I figured out to how properly run the tool. On Ubuntu I ran:
./geojson-polygon-labels < polygon.geojson > labels.geojson
However, now a new error pops out:
/home/lamnguyen/geojson-polygon-labels-master/bin/geojson-polygon-labels:25
turf.featureEach(flatInputGeoJSON, (feature) => {
^
SyntaxError: Unexpected token >
at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
What should I do now?
Edit 4: A friend of mine ran it on a "real" Ubuntu with a small sample file and it worked out. Maybe tomorrow I've give a shot :)

In this package I've set up the bin property in the package.json https://docs.npmjs.com/files/package.json#bin so when you run npm install it knows what scripts are executables. You might need to set up your PATH in your shell to the directory NPM installs the binaries to. Or use the full or relative path as you've found out.
The Unexpected Token > message seems like you're running an older version of node which doesn't support ES6 arrow functions, so try upgrading your version of node?

Related

package node with pkg ERR_INSPECTOR_NOT_AVAILABLE at run time

I am playing with pkg to package a command line example I got from a blog post. The executable created fine but when I try to run the executable, I am getting the following error:
pkg/prelude/bootstrap.js:1244
throw error;
^
Error [ERR_INSPECTOR_NOT_AVAILABLE]: Inspector is not available
at inspector.js:24:9
at NativeModule.compileForInternalLoader (internal/bootstrap/loaders.js:276:7)
at NativeModule.compileForPublicLoader (internal/bootstrap/loaders.js:218:10)
at loadNativeModule (internal/modules/cjs/helpers.js:25:9)
at Function.Module._load (internal/modules/cjs/loader.js:906:15)
at Module.require (internal/modules/cjs/loader.js:1087:19)
at Module.require (pkg/prelude/bootstrap.js:1225:31)
at require (internal/modules/cjs/helpers.js:73:18)
at Object.<anonymous> (/snapshot/ginit/lib/repo.js:11:17)
at Module._compile (pkg/prelude/bootstrap.js:1320:22) {
code: 'ERR_INSPECTOR_NOT_AVAILABLE'
}
I put the package on github and here is the link: Link to github
Any help is greatly apprecited on how to get this to work.
This Error comes up when we try to Start the executable in DEBUG mode.
Since pkg doesn't allow Inspecting the run-time code of the executable this error Inspector is not available shows up.
I was trying to spawn the executable from another program (which was running in DEBUG mode) and it caused the same issue.
But when I started the program in normal mode, it worked like a charm

Cannot find module 'unicode/category/So'

When i am trying to run this command - yo mobileangularui, its showing this error. I have read many solutions on the internet but none of them removed this error. Can anyone help?
module.js:341
throw err;
^
Error: Cannot find module 'unicode/category/So'
at Function.Module._resolveFilename (module.js:339:15)
at Function.Module._load (module.js:290:25)
at Module.require (module.js:367:17)
at require (internal/module.js:20:19)
at symbols (/usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:6:16)
at /usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:123:5
at Object.<anonymous> (/usr/lib/node_modules/generator-mobileangularui/node_modules/slug/slug.js:130:2)
There is, sometimes, an issue with npm and executing post install script. Try this steps :
cd /path/to/your/project/node_modules/unicode
check emptiness category directory with ls command
execute this command npm test
If the test is ok, you can continue your work. If it doesn't work check this issue on GitHub.
Hope it help and sorry for my English.
If you are facing this issue and you are behind windows please follow below steps, I hope worked for you :
Remove the unicode module using npm, npm remove unicode
Download the file from
http://unicode.org/Public/UNIDATA/UnicodeData.txt and placed it into
C:\usr\share\unicode-data\ if your project is in C drive, or if you are in
linux /usr/share/unicode or /usr/share/unicode-data
Install unicode again
There is a pending PR which will resolve this - https://github.com/dodo/node-unicodetable/pull/22

Microsoft Azure - Gulp 3.8.10 does not work on fresh Web App instance

I am using a fresh instance of a Web App with Node 12.3 and NPM 2.9.1. Gulp PATH appears to be set to D:\Program Files (x86)\gulp\3.8.10. I believe Gulp 3.8.10 has a bug that should be fixed with an update to 3.8.11. I am unable to use gulp until this is worked out... Unless there is another way to handle this? Any help from the Azure team would be appreciated. Deploying with Gulp has been a thorn in my side on this platform. I am trying to use vNext deployment with Angular and WebApi... My gulp CI builds can't move forward because of this. Thanks for anyone able to help!
I think this issue is noted here https://github.com/gulpjs/gulp/issues/893
Kudu Remote Execution Console
Type 'exit' then hit 'enter' to get a new CMD process.
Type 'cls' to clear the console
Microsoft Windows [Version 6.2.9200]
(c) 2012 Microsoft Corporation. All rights reserved.
D:\home>gulp -v
module.js:338
throw err;
^
Error: Cannot find module 'D:\Program Files (x86)\gulp\3.8.10\node_modules\gulp\node_modules\v8flags\3.28.73.flags.json'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Module.require (module.js:365:17)
at require (module.js:384:17)
at Object.<anonymous> (D:\Program Files (x86)\gulp\3.8.10\node_modules\gulp\bin\gulp.js:25:22)
at Module._compile (module.js:460:26)
at Object.Module._extensions..js (module.js:478:10)
at Module.load (module.js:355:32)
at Function.Module._load (module.js:310:12)
at Function.Module.runMain (module.js:501:10)
The short version:
You can install your own version of gulp where ever you have access, say D:\home\npm_tools\ for example, then override the default gulp path by setting an AppSetting GULP_PATH = D:\home\npm_tools\
The long version:
1) Go the DebugConsole above
2) npm config set prefix "D:\home\npm_tools" (or where ever you want it to be)
3) npm install -g gulp (or you can really zip up the folder from your machine and drop it somewhere if your machine is also running windows)
4) Go to portal or where you manage you app settings and set GULP_PATH = D:\home\npm_tools\
5) Refresh the DebugConsole
6) gulp -v, you should get 3.9.0 if you've just install the latest at the time of writing this comment
I realize this is a bit hacky and manual, but it should get you unblocked until we update that gulp version
I just tested gulp -v on a fresh Azure Web App. Gulp is present. Since you're experiencing a difficulty, you could try installing it.
Go to your-domain.scm.azurewebsites.net
Choose Debug console > CMD
Run npm install gulp
Test with gulp -v

JSDoc on Nodejs gives TypeError: undefined is not a function

I would like to generate automatic documentation for my javascript project using JSDoc running on Nodejs. I did the following:
Installed Nodejs
Installed jsdoc from nodejs as follows: npm install jsdoc
Everything seemed to go well. Then, I run JSDoc on a sample javascript file:
c:>jsdoc d:\version.js
C:\Users\Mark\AppData\Roaming\npm\node_modules\jsdoc\cli.js:341
packageDocs = new Package(props.packageJson);
^ TypeError: undefined is not a function
at Object.module.exports.cli.parseFiles (C:\Users\Mark\AppData\Roaming\npm\n ode_modules\jsdoc\cli.js:341:19)
at module.exports.cli.main (C:\Users\Mark\AppData\Roaming\npm\node_modules\j sdoc\cli.js:232:14)
at Object.module.exports.cli.runCommand (C:\Users\Mark\AppData\Roaming\npm\n ode_modules\jsdoc\cli.js:189:5)
at C:\Users\Mark\AppData\Roaming\npm\node_modules\jsdoc\jsdoc.js:178:13
at Object. (C:\Users\Mark\AppData\Roaming\npm\node_modules\jsdoc\ jsdoc.js:180:3)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
Please note I get this error no matter where I run jsdoc from and no matter which javascript file I use.
Can anyone help?
Update
If I delete lines 341-343 in cli.js, everything runs fine. Is it possible that these three lines are particular to a particular (i.e. non-windows) environment?
You had the misfortune of installing JSDoc on the morning of June 10, just after I introduced bug #662. I fixed the bug later that morning.
The issue is fixed in the most recent version on npm (currently 3.3.0-alpha8).
I think it's about case sensitivity.
try to copy a file ( /path/to/node_modules/jsdoc/lib/jsdoc/package.js -> package2.js )
try to modify cli.js ( var Package = require('jsdoc/package').Package; -> var Package = require('jsdoc/package2').Package; )
Good Luck!

"require.paths is removed" error running TypeScript compiler on Linux Mint

I'm new to Node.js. I have node 0.9.5-pre running on Linux Mint. I used npm (1.1.70) to install TypeScript but now I get the following error when I run tsc:
Error: require.paths is removed. Use node_modules folders, or the NODE_PATH environment variable instead.
at Function.Object.defineProperty.get (module.js:386:11)
at Object.<anonymous> (/home/rolyp/bin/tsc#0.8.0:4:21)
at Module._compile (module.js:454:26)
at Object.Module._extensions..js (module.js:472:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.runMain (module.js:497:10)
at process._tickCallback (node.js:334:13)
I gather that require.paths is not supported in recent versions of Node. There seem to be several relevant existing questions, but I don't understand the problem well enough to make use of the answers.
I tried deleting ~/.node_modules, but that didn't help.
Could someone please explain the problem and point me to a solution?
thanks
I have node 0.9.5-pre
Was a bug in the beta release that was fixed when 0.9 official came out

Resources