how to run mbpipe... a program I just installed - node.js

I'm trying to use this tool: https://github.com/mapbox/node-mbtiles/wiki/Post-processing-MBTiles-with-MBPipe
I've installed mbtiles with npm install -g mbtiles. I've also installed it locally (in the dir I'm working in) with just plain npm install mbtiles.
That part worked (I was able to download the files), but now according to the readme I can just start entering in commands like
mbpipe 'pngquant 64' myMbTilesFile.mbtiles and it's supposed to work?
Umm... don't I have to run a specific script file (like "node scriptfile.js")? This is acting like I can call functions within a script and pass it variables? I can tell you, as the user mentioned, that 'mbpipe' is within the utils.js file I have.... but how am I supposed to use it?
when I enter in the above command, I of course get "mbpipe: command not found"
So... what are they talking about?

Related

How do I run a task inside nodejs, I get npm run error

Alright, I have a extremelly newbie question to ask. How do I run the code I have on my visual estudio code?
I see my files with the code inside (the code I took it from a github public tutorial) now, in one part of the tutorial it says "let's check how it works" and types the command npm run install and then inside of the IDE terminal the code starts to run.
Now, unfortunately, the tutorial never mentions in what file we are (is it a new file) or if it's just the IDE main terminal calling up the program main function.
So, what I tried to do was to put the same line of code on the terminal of visual estudio code, and I get this error:
'npm' is not recognized as internal or external command, operable program or batch file.
Now, what I am thinking is that I need to type npm install in a specific window, but on the tutorial is just stated "let's take a look at the program"
sorry, I feel as I am asking were do I put the keys to enter my house, it is an extremelly simple/dumb question, but I guess these little details are what make newbies like me get lost in the most simple tasks.
I also tried the menu on visual studio code, click on terminal and then on run task and then select one of the options that are on the default -install or npm run start. Same error.
You need to install npm globally. If you are using Windows you will probably need to add it in environment variables also. Check also if you have install Node.js (when you install Node.js, npm will be automatically installed).
You can check this Docs: https://docs.npmjs.com/downloading-and-installing-node-js-and-npm
Once you do that you can use npm as a command in your terminal.

Possible way to create a command line tool in node.js

I am building a nodejs based small framework for my application. Say, the name of the framework is coffee-cup, situated in the folder of the same name. The folder has a structure inside. To simplify the work of developers, I want to add few command line methods. For example, consider following folder structure.
coffee-cup
|--config
|--cups
|--cup1
|--index.js
|--report
|--cup-config
|--cup2
|--index.js
|--report
|--cup-config
We see that inside cup1 and cup2, there is same structure. If a developer wants to add a new cup called cup3, they will need to create a folder called cup3 and add the underlying structure into that folder.
To automate this task, I am thinking of a way to build a command line utility like
$ coffee-cup new cup cup3
that can work on linux, windows or mac terminals.
Expected result of Entering this command in terminal: would create a new folder called cup3 in cups folder and will create the file index.js and folders reporting and cup-config inside the folder cup3.
I can create folder using fs.mkdirSync()and file using fs.writeFile().
I am however, unable to find a way to make the terminal identify the coffee-cup command. If terminal identifies this command, it should collect the following arguments and pass on to the nodejs file and I can continue from there. What I know is, that there exist npm packages like inquire which are useful in creating command line applications. But it does not help in building command line utilities like I mentioned above.
So I am looking for guidance on making terminal identify the coffee-cup command, collect the following arguments and pass on everything to a nodejs file. It is just like we install npm and then terminal starts identifying the npm keyword and subsequent commands like $ npm install. Any help by experts will be highly appreciated.

Fly command won't work after installing flight plan

So I was working through a tutorial to deploy my node app to a server. They had me npm install flightplan -g so I can use the 'fly' command. This all worked but for the fly command to work I needed to install rsync. I finally got rsync to work after changing my PATH. But now when I use to fly command I get "'fly' is not recognized as an internal or external command,
operable program or batch file."
I've tried changing the PATH hundreds of times to different things and I can't for the life of my get the fly command to work again. I've tried reinstalling flightplan globally a bunch of times. NOTHING IS WORKING.
Node JS NPM modules installed but command not recognized
This was the answer I was looking for.. I had the end of my path set to npm/fly and not just npm....

How to tersely run a globally installed Node.js app

I was recently using mongo-express which is written in Node.js. I've installed it globally following instructions on their GitHub page. It says in order to run it:
cd YOUR_PATH/node_modules/mongo-express/ && node app.js
I was wondering if there's any workarounds to avoid changing directory to the app's folder first (using cd).
By the way, in npm's doc, it says
When in global mode, executables are linked into {prefix}/bin on Unix.
In my case (using mac), executable app.js is linked into /usr/local/bin. But if I just type app.js in the command line trying to run it, it'd say -bash: /usr/local/bin/app.js: Permission denied. Even if this works, wouldn't app.js be a too generic name and become conflicted with other apps later?
Thanks for helping.

Nodejs on Win7 - use npm only through Nodejs command prompt

I have a question about usage of Nodejs.
I installed it on Win7 and run (green Node.js icon) it, but when I tried to run "npm install" command it dodn't work. I had to move to Nodejs command prompt where npm is working.
Is that how it supposed to work?
Once you install NodeJS under Windows, it goes into the global PATH, meaning that it is available in the usual Windows command prompt. So, just open one by pressing:
Windows+R
Type cmd and press Enter
Then type node -v. You should be able to see an appropriate response.
Add your AppData\Roaming\npm and Program Files\nodejs folder to your path.
Also have a look at this:
Node.js doesn't recognize system path?
Second answer helped me to add my Roaming folder.

Resources