Skip to content

Using N|Solid runtime without installing it officially

License

Notifications You must be signed in to change notification settings

nodesource/nsolid-npm

Repository files navigation

N|Solid

N|Solid From NPM

Description

This module is intended to be used as a quickstart with N|Solid SaaS platform and also works in restricted environments where N|Solid runtime is not installed.

See examples of how to use it.

Requirements

  • We only support LTS versions, so this will fail for stable Node.js versions.
  • Shouldn't you have a valid N|Solid SaaS license, consider downloading and installing the N|Solid for desktop on your local machine.

Installation

Install the module for your project as a regular dependency:

npm install nsolid

or using npx:

npx nsolid

Usage

How to add nsolid to an existent project

  • Run npm install nsolid on the package.json's project location

  • Replace the node command with nsolid at the desired npm scripts executing the applications you want to connect to the N|Solid Console, like this

    before:

      "scripts": {
        "start": "node index.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },

    after:

      "scripts": {
        "start": "nsolid index.js",
        "test": "echo \"Error: no test specified\" && exit 1"
      },

How to get my N|Solid Command URL

Instructions for N|Solid Local Instance

  • The command for N|Solid Desktop is localhost:9001
  • The URL for N|Solid Console is http://localhost:6753

Instructions for N|Solid SaaaS

  • You should see the same page as below:

The page shows you the Console URL and the NodeSource SaaS command that you'll need to link your app where:

  1. The console URL available to copy it
  2. a button to visit the console page
  3. your account N|Solid command address

Copy the the command address to use it on the next section.

How to link your Node.js app to a N|Solid Console

  • In order to link your current application to the desired N|Solid Console you must add configuration properties either on your package.json or using the NSOLID_COMMAND, for local N-Solid instance, or NSOLID_SAAS environment variables on your machine. See our examples.

  • Should you add the configuration on your current package.json file, it should look as follows:

    before:

      "scripts": {
        "start": "nsolid index.js"
      },

    after:

      "scripts": {
        "start": "nsolid index.js"
      },
      "nsolid": {
        "saas": "YOUR N|Solid SaaS URL"
      }

    or for local N|Solid instance:

    after:

      "scripts": {
        "start": "nsolid index.js"
      },
      "nsolid": {
        "command": "localhost:9001"
      }
    

For more information on these settings please go to https://docs.nodesource.com/nsolid/4.5/docs#nsolid-runtime

  • Then, after running npm start command, go back to the browser and visit the console (as shown on the previous section).
  • Your N|Solid Console show the apps you've linked as follows:

If you're running the N|Solid Console locally, you just need to open the URL http://localhost:6753 and you should see the same page as above.

How it works

It downloads the latest version of the runtime matching the current Node.js LTS used in the local Node.js installation.

The download happens at the postinstall process of this module, then proceeds to extract and put the runtime files at the current user's home directory inside a folder like .nsolid-runtime/nsolid-fermium to be used later by an NPM command.

The module includes a command called nsolid, which is designed to replace the node command inside an NPM script and then executes the original task using the N|Solid binary previously downloaded at the postinstall phase.

Currently, this module supports Linux, Windows, and Mac.

Contributing

To submit a bug report, please create an issue at GitHub.

Contributions are always welcome!

License & Copyright

nsolid-npm is Copyright (c) 2021 NodeSource and licensed under the MIT license. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.

The projects contained within the nsolid-npm images maintain their own Licenses.

About

Using N|Solid runtime without installing it officially

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 4

  •  
  •  
  •  
  •