node install | | Install dev tools on Linux | Search

This code sets up a development environment for NativeScript on a Debian system by installing Node.js, necessary packages, and configuring security settings.

Run example

npm run import -- "use nodejs"

use nodejs

wget -O - https://deb.nodesource.com/setup_8.x | bash
apt-get install -y nodejs
nodejs -v

env NODE_TLS_REJECT_UNAUTHORIZED 0
npm install -g live-server babel-cli concurrently node-gyp nativescript@latest

What the code could have been:

#!/bin/bash

# Set up Node.js 8.x repository
curl -fsSL https://deb.nodesource.com/setup_8.x | bash -l

# Install Node.js and necessary dependencies
apt-get update
apt-get install -y nodejs

# Check Node.js version
nodejs -v

# Set environment variable NODE_TLS_REJECT_UNAUTHORIZED to 0
export NODE_TLS_REJECT_UNAUTHORIZED=0

# Install global packages with npm
export NPM_CONFIG_PRODUCTION=false
npm install -g \
    live-server \
    babel-cli \
    concurrently \
    node-gyp \
    nativescript@latest

# Note: Consider adding error handling for failed package installations

This code snippet sets up a Node.js development environment for NativeScript on a Debian-based system.

Here's a breakdown:

  1. Node.js Installation:

  2. Node.js Version Check:

  3. Security Configuration:

  4. Package Installation:

Let me know if you have any other code snippets you'd like me to explain!