To run a Node.js application on MacOS, follow these three steps. Open Terminal by pressing Command+Space to open Spotlight Search and entering terminal into the search box. Enter the following command, then press Return to create a file named test-node.js containing a simple application that will print out the result 1 + 1.
- The gist is that it basically extends the JS engine for you to write a web-based app supporting node's extended object model, and modules. You then package your package.json start.html modules and js files into a zip (with the.nw extension) and run it with nw(.exe). There are windows, mac and linux builds.
- If you want the flexibility to sometimes develop/run your Node.js app directly on the host, and then other times spin it up in a local container, then Solution B is your jam. In this case you need a nodemodules on host that is built for that OS, and a different nodemodules in the container for Linux.
This page contains a list of all system requirements needed to build and run NativeScript apps on macOS, as well as a guided walkthrough for getting these requirements in place. On macOS systems, you can use the NativeScript CLI to develop Android and iOS apps.
System Requirements
- macOS High Sierra or later
- The latest stable official release of Node.js (LTS) 10.x.
- (Optional) Homebrew to simplify the installation of dependencies
- For iOS development
- Latest Xcode
- Command-line tools for Xcode
- xcodeproj ruby gem
- CocoaPods
- The
six
python package
- For Android development
- JDK 8 or later
- Latest official release of Android SDK
- Android Support Repository
- (Optional) Google Repository
- Android SDK Build-tools 28.0.3 or later
You must also have the following two environment variables setup for Android development:
- JAVA_HOME
- ANDROID_HOME
Advanced Setup Steps
Upload photos to facebook from mac photos app. Complete the following steps to setup NativeScript on your macOS development machine:
-
Install Homebrew to simplify the installation process.
-
Install the latest Node.js (LTS) 10.x.
- After you run the command above you will see this on console:
If you need to have this software first in your PATH run:echo 'export PATH='/usr/local/opt/node@10/bin:$PATH' >> ~/.bash_profile
In order to make node available, please add it to path with this command:echo 'export PATH='/usr/local/opt/node@10/bin:$PATH' >> ~/.bash_profile
Then restart the terminal or runsource ~/.bash_profile
command.
- After you run the command above you will see this on console:
-
Install the dependencies for iOS development.
- Run the App Store and download Xcode.
-
Start Xcode and you will be prompted to install Command Line Tools for Xcode.
- To verify that the installation is correct please run
xcodebuild -version
If command above do not pass then build tools are either not installed or not selected.You can select build tools viaxcode-select
command or via Xcode (Preferences -> Locations -> Command Line Tools).
- To verify that the installation is correct please run
-
Install the xcodeproj ruby gem with the following command.
-
Install CocoaPods
-
Setup CocoaPods
-
Install pip
-
Install python
six
package
-
Install the dependencies for Android development.
- Set up JDK 8.
-
Set the JAVA_HOME system environment variable.
-
Install the Android SDK.
-
In the terminal, run the following command:
-
Next, run the following command to set the ANDROID_HOME system environment variable:
NOTE: : If you are installing via Android SDK Manager, then the path for ANDROID_HOME would be '/Users/$userid/Library/Android/sdk/' .
NOTE: This is the directory that contains the
tools
andplatform-tools
directories.NOTE: In order to persist these variables after your terminal session is closed, they have to be persisted in your shell profile file (e.g.
~/.bash_profile
if you are using Bash,~/.zprofile
if you are using Zsh) -
In addition, install all packages for the Android SDK Platform 28, Android SDK Build-Tools 28.0.3 or later, Android Support Repository, Google Repository and any other SDKs that you may need. You can alternatively use the following command, which will install all required packages.If you are behind a corporate proxy, it might be necessary to pass additional arguments. You can check sdkmanager documentation
-
-
Setup Android Emulators (AVD) by following the article here
-
Mac apps best free. Install the NativeScript CLI.
-
Run the following command. https://cleverlightning224.weebly.com/blog/best-wifi-security-app-mac.
-
Restart the command prompt.
-
-
To check if your system is configured properly, run the following command.
If you see 'No issues were detected' you are good to go!
![Running App Built With Node.js On Mac Running App Built With Node.js On Mac](/uploads/1/3/4/0/134051795/192322023.png)
What’s Next
Follow me on twitch!
Since node.js is the new cool kid on the block, I want to write a really short introduction how to install it on Mac OS X and start playing with it.
Exploring technologies is something I try to fit in my everyday, that’s why I’m choosing the verb playing. This little and quick guide is really more for everyone who has more experience with PHP than with ruby or python. I don’t even want to talk to you ruby on rails people, you know how all this stuff works, shoo!
Exploring technologies is something I try to fit in my everyday, that’s why I’m choosing the verb playing. This little and quick guide is really more for everyone who has more experience with PHP than with ruby or python. I don’t even want to talk to you ruby on rails people, you know how all this stuff works, shoo!
Homebrew
Not only for node.js, but a powerful tool that every developer on Mac OS should have or have heard of: homebrew. So head on and install it, because it allows you to install node.js with one command (Terminal phobics, don’t worry, it’s short!) and gets you going on setting up your testing environment.
Getting node.js
To install node.js on your machine, you simply type:
That’s it. You watch a short process of download and build, which has not failed the couple of times I’ve tried it on both Mac OS 10.6 and 10.7, but don’t close that Terminal quite yet.
Running node.js
Running App Built With Node.js On Mac Download
For running node.js you actually need to run a process in your shell or make something run the process for you. For now, we’ll stick to having the Terminal window open.
How to Node has a very comprehensive guide how to send output to a browser, by making node start an http server and listen for requests. Requests, as in every web capable programming language are important in node.js and you’ll be hearing a lot more about this request object in the future.
How to Node has a very comprehensive guide how to send output to a browser, by making node start an http server and listen for requests. Requests, as in every web capable programming language are important in node.js and you’ll be hearing a lot more about this request object in the future.
So what you don’t need to do is to define a directory, like you know from apache or lighttpd servers. You can create a node project in any folder on your system, go there in a Terminal window and run your .js file with node filename.js, followed by hitting ENTER.
Download Node Js For Mac
Example:
Let’s say we wanted to use the hello world example, we’d shamelessly copy paste the code into our text editor and save it in a folder called nodetests. Now with the Terminal we type something like:
Now we have a running node server on the specified port, that will output Hello World on a specified address. You can see the output by pointing your browser to http://localhost:3000 and it should say: Hello World.
Going back to your editor and changing some lines will have absolutely no effect right now, because node does not check for file changes by default. So even if your file would now output `Hello Moon`, the node server still thinks that it should output `Hello World`, because it was that the last time it checked.
To prevent you from undergoing the horrible task of changing to your Terminal window, pressing
every time you make a change you want to preview, there actually is a way to skip that.
Using node-dev instead of node, automatically restarts your server, whenever it notices a file changed. That’s way cooler and feels a lot more like developing PHP suddenly. It’s not bad to feel a little at home when you start on frighteningly seeming complex stuff like node.js.
NPM: the node package manager
NPM is what apt is for debian or gem for ruby. It’s the universal tool for getting stuff and also packing stuff up in neat and reuseable modules.
Taking a look at the amazing list of modules available and also their own repository site, you will quickly understand why you will want to use it.
By simply typing
Taking a look at the amazing list of modules available and also their own repository site, you will quickly understand why you will want to use it.
By simply typing
you’ll install an hmvc framework, make it available for your project and also have the frameworks own tools for debugging, running servers or similar at hand.
Node.js community
I have not personally met anyone who actually has developed with node, but I’ve recently infected another developer with it.
Although I have joined the IRC channel, because I was stuck on some typical node.js beginner issues like correct use of callbacks and understanding how to prevent node.js from spawing 84 processes on resizing 18.8MP images with the imagemagick module. If you don’t watch out, you’re going to do more stuff parallel than you actually intend to and definitely more than your Mac Book Pro can handle without crashing (seriously).
Especially spion helped me and actually restructured some of my code for my understanding, which was pretty amazing of him, also looking at the things he actually has published. Kudos to him.
Although I have joined the IRC channel, because I was stuck on some typical node.js beginner issues like correct use of callbacks and understanding how to prevent node.js from spawing 84 processes on resizing 18.8MP images with the imagemagick module. If you don’t watch out, you’re going to do more stuff parallel than you actually intend to and definitely more than your Mac Book Pro can handle without crashing (seriously).
Especially spion helped me and actually restructured some of my code for my understanding, which was pretty amazing of him, also looking at the things he actually has published. Kudos to him.
Thank you for reading! If you have any comments, additions or questions, please leave them in the form below! You can also tweet them at me
Running App Built With Node.js On Mac Computer
If you want to read more like this, follow me on feedly or other rss readers