Giter Site home page Giter Site logo

n's Introduction

n – Interactively Manage Your Node.js Versions

npm npm npm npm

Node.js version management: no subshells, no profile setup, no convoluted API, just simple.

usage animation

Supported Platforms

n is supported on macOS, Linux, including with Windows Subsystem for Linux, and various other unix-like systems. It is written as a BASH script but does not require you to use BASH as your command shell.

n does not work in native shells on Microsoft Windows (like PowerShell), or Git for Windows BASH, or with the Cygwin DLL.

Installation

If you already have Node.js installed, an easy way to install n is using npm:

npm install -g n

The default root location used when running n is /usr/local where a normal user does not have write permission. You may strike the same sort of permission error when using npm to install global modules, like the above command. You have three main options:

  1. change the ownership of the relevant directories to yourself (see below)
  2. tell n to use a custom location where you do have write permissions (see N_PREFIX)
  3. put sudo in front of the command to run it as super user

n caches Node.js versions in subdirectory n/versions. The active Node.js version is installed in subdirectories bin, include, lib, and share.

To take ownership of the system directories (option 1):

# make cache folder (if missing) and take ownership
sudo mkdir -p /usr/local/n
sudo chown -R $(whoami) /usr/local/n
# make sure the required folders exist (safe to execute even if they already exist)
sudo mkdir -p /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share
# take ownership of Node.js install destination folders
sudo chown -R $(whoami) /usr/local/bin /usr/local/lib /usr/local/include /usr/local/share

If npm is not yet available, one way to bootstrap an install is to download and run n directly. To install the lts version of Node.js:

curl -fsSL https://raw.githubusercontent.com/tj/n/master/bin/n | bash -s lts
# If you want n installed, you can use npm now.
npm install -g n

Alternatively, you can clone this repo and

make install

which defaults to /usr/local/bin/n. To install n in a custom location such as $CUSTOM_LOCATION/bin/n, run PREFIX=$CUSTOM_LOCATION make install.

Third Party Installers

On macOS with Homebrew you can install the n formula.

brew install n

Or on macOS with MacPorts you can install the n port:

port install n

On Linux and macOS, n-install allows installation directly from GitHub; for instance:

curl -L https://bit.ly/n-install | bash

n-install sets both PREFIX and N_PREFIX to $HOME/n, installs n to $HOME/n/bin, modifies the initialization files of supported shells to export N_PREFIX and add $HOME/n/bin to the PATH, and installs the latest LTS Node.js version.

As a result, both n itself and all Node.js versions it manages are hosted inside a single, optionally configurable directory, which you can later remove with the included n-uninstall script. n-update updates n itself to the latest version. See the n-install repo for more details.

Replacing a previous node install

Changing from a previous Node.js installed to a different location may involve a few extra steps. See docs for changing node location for a walk-through example of switching from using Homebrew to using n to manage Node.js.

You have a problem with multiple versions if after installing node you see the "installed" and "active" locations are different:

% n lts
     copying : node/20.12.2
   installed : v20.12.2 to /usr/local/bin/node
      active : v21.7.3 at /opt/homebrew/bin/node

Installing Node.js Versions

Simply execute n <version> to download and install a version of Node.js. If <version> has already been downloaded, n will install from its cache.

n 10.16.0
n lts

Execute n on its own to view your downloaded versions, and install the selected version.

$ n

  node/4.9.1
ο node/8.11.3
  node/10.15.0

Use up/down arrow keys to select a version, return key to install, d to delete, q to quit

(You can also use j and k to select next or previous version instead of using arrows, or ctrl+n and ctrl+p.)

If the active node version does not change after install, try opening a new shell in case seeing a stale version.

Specifying Node.js Versions

There are a variety of ways of specifying the target Node.js version for n commands. Most commands use the latest matching version, and n ls-remote lists multiple matching versions.

Numeric version numbers can be complete or incomplete, with an optional leading v.

  • 4.9.1
  • 8: 8.x.y versions
  • v6.1: 6.1.x versions

There are labels for two especially useful versions:

  • lts: newest Long Term Support official release
  • latest, current: newest official release

There is an auto label to read the target version from a file in the current directory, or any parent directory. n looks for in order:

  • .n-node-version: version on single line. Custom to n.
  • .node-version: version on single line. Used by multiple tools: node-version-usage
  • .nvmrc: version on single line. Used by nvm.
  • if no version file found, look for engine as below.

The engine label looks for a package.json file and reads the engines field to determine compatible Node.js. Requires an installed version of node, and uses npx semver to resolve complex ranges.

There is support for the named release streams:

  • argon, boron, carbon: codenames for LTS release streams

These Node.js support aliases may be used, although simply resolve to the latest matching version:

  • active, lts_active, lts_latest, lts, current, supported

The last version form is for specifying other releases available using the name of the remote download folder optionally followed by the complete or incomplete version.

  • nightly
  • test/v11.0.0-test20180528
  • rc/10

Removing Versions

Remove some cached versions:

n rm 0.9.4 v0.10.0

Removing all cached versions except the installed version:

n prune

Remove the installed Node.js (does not affect the cached versions). This can be useful to revert to the system version of node (if in a different location), or if you no longer wish to use node and npm, or are switching to a different way of managing them.

n uninstall

Using Downloaded Node.js Versions Without Reinstalling

There are three commands for working directly with your downloaded versions of Node.js, without reinstalling.

You can show the path to the downloaded node version:

$ n which 6.14.3
/usr/local/n/versions/6.14.3/bin/node

Or run a downloaded node version with the n run command:

n run 8.11.3 --debug some.js

Or execute a command with PATH modified so node and npm will be from the downloaded Node.js version. (NB: npm run this way will be using global node_modules from the target node version folder.)

n exec 10 my-script --fast test
n exec lts zsh

Preserving npm

A Node.js install normally also includes npm, npx, and corepack, but you may wish to preserve your current (especially newer) versions using --preserve:

$ npm install -g npm@latest
...
$ npm --version
6.13.7
# Node.js 8.17.0 includes (older) npm 6.13.4
$ n -p 8
   installed : v8.17.0
$ npm --version
6.13.7

You can make this the default by setting the environment variable to a non-empty string. There are separate environment variables for npm and corepack:

export N_PRESERVE_NPM=1
export N_PRESERVE_COREPACK=1

You can be explicit to get the desired behaviour whatever the environment variables:

n --preserve nightly
n --no-preserve latest

Miscellaneous

Command line help can be obtained from n --help.

List matching remote versions available for download:

n ls-remote lts
n ls-remote latest
n lsr 10
n --all lsr

List downloaded versions in cache:

n ls

Use n to access cached versions (already downloaded) without internet available.

n --offline 12

Display diagnostics to help resolve problems:

n doctor

Custom Source

If you would like to use a different Node.js mirror which has the same layout as the default https://nodejs.org/dist/, you can define N_NODE_MIRROR. The most common example is from users in China who can define:

export N_NODE_MIRROR=https://npmmirror.com/mirrors/node

If the custom mirror requires authentication you can add the url-encoded username and password into the URL. e.g.

export N_NODE_MIRROR=https://encoded-username:encoded-password@host:port/path

There is also N_NODE_DOWNLOAD_MIRROR for a different mirror with same layout as the default https://nodejs.org/download.

Custom Architecture

By default n picks the binaries matching your system architecture. For example, on a 64 bit system n will download 64 bit binaries.

On a Mac with Apple silicon:

  • for Node.js 16 and higher, n defaults to arm64 binaries which run natively
  • for older versions of Node.js, n defaults to x64 binaries which run in Rosetta 2

You can override the default architecture by using the -a or --arch option.

e.g. reinstall latest version of Node.js with x64 binaries:

n rm current
n --arch x64 current

Optional Environment Variables

The n command downloads and installs to /usr/local by default, but you may override this location by defining N_PREFIX. To change the location to say $HOME/.n, add lines like the following to your shell initialization file:

export N_PREFIX=$HOME/.n
export PATH=$N_PREFIX/bin:$PATH

If you want to store the downloads under a different location, use N_CACHE_PREFIX. This does not affect the currently active node version.

n defaults to using xz compressed Node.js tarballs for the download if it is likely tar on the system supports xz decompression. You can override the automatic choice by setting an environment variable to zero or non-zero:

export N_USE_XZ=0 # to disable
export N_USE_XZ=1 # to enable

You can be explicit to get the desired behaviour whatever the environment variable:

n install --use-xz nightly
n install --no-use-xz latest

In brief:

How It Works

n downloads a prebuilt Node.js package and installs to a single prefix (e.g. /usr/local). This overwrites the previous version. The bin folder in this location should be in your PATH (e.g. /usr/local/bin).

The downloads are kept in a cache folder to be used for reinstalls. The downloads are also available for limited use using n which and n run and n exec.

The global npm packages are not changed by the install, with the exception of npm itself which is part of the Node.js install.

n's People

Contributors

73rhodes avatar altern8tif avatar antsword avatar benatkin avatar boopathi avatar chrootsu avatar davglass avatar deedeeg avatar drewwells avatar dshaw avatar jeromedecoster avatar johnhamelink avatar mashiox avatar maxrimue avatar mediremi avatar mklement0 avatar peterdavehello avatar qw3rtman avatar ralphtheninja avatar samihostikka avatar shadowspawn avatar shurane avatar stefanmaric avatar tj avatar tjwebb avatar tomgco avatar tootallnate avatar troy0820 avatar vincentmac avatar yorkie avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

n's Issues

npm install n

This no longer works, unsure of version. n has to be installed globally via npm install n -g

Problem installing 0.6.0+?

I tried to install node 0.6.0 or 0.6.1 with n, but it didn't work. Digging into the logs it says

######################################################################## 100.0%
Error: installation failed
  node version 0.6.0 does not exist,
  n failed to fetch the tarball,
  or tar failed. Try a different
  version or view /tmp/n.log to view
  error details.

// Inside /tmp/n.lpg
tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

Any ideas?

Uninstalling n

How do I go about uninstalling n? I was unable do it via npm.

Can not remove 0.4.12

I am on a fresh centos6 image. I did an: "n stable" which install 0.6.11

I later installed 0.4.12, and now I cant get rid of it anymore, any ideas?

[root@api-2 bin]# n
0.4.12
ο 0.6.11
[root@api-2 bin]# n uninstall 0.4.12
/usr/local/bin/n: line 155: test: uninstall: integer expression expected

################################################################## 100.0%

rm: cannot remove `node-vuninstall.tar.gz': No such file or directory
\033[31mError: installation failed\033[0m
node version uninstall does not exist,
n failed to fetch the tarball,
or tar failed. Try a different
version or view /tmp/n.log to view
error details.

the log says:
[root@api-2 commotion]# more /tmp/n.log

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

0.6.0 installation fails

trying to run:

$ n latest

results in:

######################################################################## 100.0%
Error: installation failed
  node version 0.6.0 does not exist,
  n failed to fetch the tarball,
  or tar failed. Try a different
  version or view /tmp/n.log to view
  error details.

/tmp/n.log just complains that the archive is not an archive (probably 0 bytes)

tar: Unrecognized archive format
tar: Error exit delayed from previous errors.

possibly n is pointing to the wrong place?

add current node to list of nodes when installing n from npm

Just a feature idea:

When installing node from source, then installing npm, and then running n, it will output:

*

Although there is a version of node installed already. I wonder if n could notice that version and pull its files into the n/version directory like it does with new versions? Just a thought!

n stable

as suggested by someone, would be useful to grab evens while latest could grab either

node-waf issue

sorry TJ to bug you again, but I now get the node-waf command but it still doesn't build, and I'm not sure where the issue would be, it may no longer be with 'n', if I run node-waf I get:

Traceback (most recent call last):
  File "/usr/local/bin/node-waf", line 14, in <module>
    import Scripting
ImportError: No module named Scripting

And if I try to install something from npm, like: npm install base64

I get the following error output:

npm ERR! Error: [email protected] install: `node-waf configure build`
npm ERR! `sh` failed with 1
npm ERR!     at ChildProcess.<anonymous (/usr/local/lib/node/.npm/npm/0.2.15/package/lib/utils/exec.js:25:18)
npm ERR!     at ChildProcess.emit (events:34:17)
npm ERR!     at ChildProcess.onexit (child_process:168:12)
npm ERR!     at node.js:773:9
npm ERR! 
npm ERR! Failed at the [email protected] install script.
npm ERR! This is most likely a problem with the base64 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     node-waf configure build
npm ERR! You can get their info via:
npm ERR!     npm owner ls base64
npm ERR! There may be additional logging output above.

Using n to install node broke NPM

I've been working on node 4.7 for a long time because that's all Heroku supported, but recently they announced support for other versions, so I was looking to upgrade node. Since I have production code working on 4.7, I need to swap between 4.7 and 6.13.

n seems awesome and I'd love to use it. For running node, it works fine. But something happened when I installed it such that npm no longer works.

If I switch to n 0.4.7 and run 'npm install' for a module I get:

node.js:134
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module '../lib/npm.js'
at Function._resolveFilename (module.js:320:11)
at Function._load (module.js:266:25)
at require (module.js:348:19)
at /usr/local/lib/node_modules/npm/bin/npm.js:24:11
at Object. (/usr/local/lib/node_modules/npm/bin/npm.js:87:2)
at Module._compile (module.js:404:26)
at Object..js (module.js:410:10)
at Module.load (module.js:336:31)
at Function._load (module.js:297:12)
at Array. (module.js:423:10)

If I switch to n 0.6.13 and run 'npm install' for a module I get:

node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: No such module
at Object. (/usr/local/lib/node_modules/npm/lib/utils/config-defs.js:5:21)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:31)
at Function._load (module.js:308:12)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object. (/usr/local/lib/node_modules/npm/lib/utils/ini.js:40:18)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)

Your help would be most appreciated as I can't seem to figure it out. Thanks!

node-waf doesn't seem to be linked up

installing versions don't seem to get node-waf linked up, npm is failing on installing any project that needs that to build. unless i'm missing something.

n causing problems with node-waf ? (bug)

Since I installed n and tried to also install something like GeoIP or anything else that needed compiling with node-waf, I get:

Traceback (most recent call last):
File "/usr/local/bin/node-waf", line 14, in
import Scripting
ImportError: No module named Scripting

I have python 2.7, I run on node 0.4.12 and these things compiled before using n.

I'm no expert, but on a forum I found this:

"In fact nodejs-waf script adds /usr/share/nodejs/wafadmin and Tools/
to sys.path before importing Scripting module.
That might be screwed by setting PREFIX_NODE environment variable.
Is that the case for you ?"

And on n's documentation I seen something mentioned about PREFIX_NODE.

Please look into this, n is perfect and I want to keep using it, but at the same time I sometimes need compiled node modules :)

Not installing 0.6.0

I get this error
n 0.6.0
######################################################################## 100.0%
Error: installation failed
node version 0.6.0 does not exist,
n failed to fetch the tarball,
or tar failed. Try a different
version or view /tmp/n.log to view
error details.

Same if I do n v0.6.0

Bad substitution

Function install_node fails in bash 4.1.5(1)-release (x86_64-pc-linux-gnu), in test if char v exists, minimizing it into simple delete fixes it.

Solution:

install_node() {
  local version=$1; shift
  local config=$@
  check_current_version

  # remove "v"
  version=${version#v}

  # already active
  test "$version" = "$active" && return

  # installed
  local dir=$VERSIONS_DIR/$version
  if test -d $dir; then
    cd $dir \
      && cp -fr $dir/include/node $PREFIX/include \
      && cp -f $dir/bin/node $PREFIX/bin/node
  # install
  else
    local dir="node-v$version"
    cd $N_PREFIX/n \
      && $GET "http://nodejs.org/dist/node-v$version.tar.gz" \
      > "$dir.tar.gz" \
      && tar -zxf "$dir.tar.gz" \
      && cd $dir \
      && ./configure --prefix $VERSIONS_DIR/$version $config\
      && make install \
      && cd .. \
      && cleanup $version \
      && n $version
  fi
}

Unable to install node versions newer than 0.5.0

Getting the following error when attempting to n versions newer than 0.5.0:

Matt-Walterss-MacBook-Pro:n matt$ n 0.5.3
######################################################################## 100.0%
Error: installation failed
node version 0.5.3 does not exist,
n failed to fetch the tarball,
or tar failed. Try a different
version or view /tmp/n.log to view
error details.
Matt-Walterss-MacBook-Pro:n matt$ cat /tmp/n.log 
tar: Unrecognized archive format: Inappropriate file type or format
tar: Error exit delayed from previous errors.

Thanks,

Matt

Install npm automatically

Could npm be installed automatically when installing a node version?

According to the node.js release information (http://blog.nodejs.org) each version has npm included, but when installing a node.js version using n it's omitted.

npm shortcut

Hey guys,

The below sh snippet will make npm always work, and always be the current version. I'd like to add this to the readme, but wasn't sure what section / etc would be preferable. I'm putting this here both as a reference, and for us to discuss. I'll submit a pull request if @visionmedia can let me know where to put it, or if he'd like to put it in there, etc.

function npm() {
    active=$(node --version);
    active=${active#v};
    n npm $active $@
}

n and 0.8

I did n stable and got 0.6.18. I canceled the 0.6.18 install and now I can't get rid of it. n rm 0.6.18 silently fails.

Now node -v gives me v0.6.18. I don't know if I had 0.6.18 before. I will install n stable again and hopefully my node will be ok.

Colors mis-print on Linux

In version 0.6.0 in the printf statements the control sequence \e needs to revert back to \033 so that it will print colors on Linux.

Does not work after installing node from package manager in ubuntu

Steps to reproduce:

  1. install node from package manager in ubuntu (see https://github.com/joyent/node/wiki/Installing-Node.js-via-package-manager)
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
  1. install npm and n
  2. execute n 0.6.12, everything goes well
  3. execute node --version ==> returns 0.6.11, as installed by package manager

Update: it appears that sudo node --version returns 0.6.12 while node --version returns 0.6.11.

Why does n not also install it locally, so I don't need to run node as root?

npm ERR! error installing [email protected]

npm http 200 https://registry.npmjs.org/n/-/n-0.7.3.tgz
npm ERR! Could not create /usr/local/lib/node_modules/___n.npm
npm ERR! error installing [email protected]
npm ERR! Error: EACCES, permission denied '/usr/local/lib/node_modules/___n.npm'
npm ERR! Report this entire log at:
npm ERR! http://github.com/isaacs/npm/issues
npm ERR! or email it to:
npm ERR! [email protected]
npm ERR!
npm ERR! System Darwin 12.0.0
npm ERR! command "node" "/usr/local/bin/npm" "install" "-g" "n"
npm ERR! cwd /Users/merhawie
npm ERR! node -v v0.6.7
npm ERR! npm -v 1.1.0-beta-10
npm ERR! path /usr/local/lib/node_modules/___n.npm
npm ERR! code EACCES
npm ERR! message EACCES, permission denied '/usr/local/lib/node_modules/___n.npm'
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /Users/merhawie/npm-debug.log
npm not ok

Error: no Xcode is selected

I haven't installed Xcode on my dev machine, but I installed the Command Line Tools to be able to use Homebrew. Homebrew is working fine, now n is throwing a strange error when trying to configure node:

$ n 0.8.7
######################################################################## 100,0%
{ 'target_defaults': { 'cflags': [],
                       'default_configuration': 'Release',
                       'defines': [],
                       'include_dirs': [],
                       'libraries': []},
  'variables': { 'clang': 1,
                 'host_arch': 'x64',
                 'node_install_npm': 'true',
                 'node_install_waf': 'true',
                 'node_prefix': '/usr/local/n/versions/0.8.7',
                 'node_shared_openssl': 'false',
                 'node_shared_v8': 'false',
                 'node_shared_zlib': 'false',
                 'node_use_dtrace': 'false',
                 'node_use_etw': 'false',
                 'node_use_openssl': 'true',
                 'target_arch': 'x64',
                 'v8_no_strict_aliasing': 1,
                 'v8_use_snapshot': 'true'}}
creating  ./config.gypi
creating  ./config.mk
xcode-select: Error: No Xcode is selected. Use xcode-select -switch <path-to-xcode>, or see the xcode-select manpage (man xcode-select) for further information.

Traceback (most recent call last):
  File "tools/gyp_node", line 58, in <module>
    run_gyp(gyp_args)
  File "tools/gyp_node", line 18, in run_gyp
    rc = gyp.main(args)
  File "./tools/gyp/pylib/gyp/__init__.py", line 480, in main
    generator.GenerateOutput(flat_list, targets, data, params)
  File "./tools/gyp/pylib/gyp/generator/make.py", line 2082, in GenerateOutput
    part_of_all=qualified_target in needed_targets)
  File "./tools/gyp/pylib/gyp/generator/make.py", line 764, in Write
    self.Pchify))
  File "./tools/gyp/pylib/gyp/generator/make.py", line 1137, in WriteSources
    cflags = self.xcode_settings.GetCflags(configname)
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 259, in GetCflags
    sdk_root = self._SdkPath()
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 248, in _SdkPath
    return os.path.join(self._GetSdkBaseDir(), '%s.sdk' % sdk_root)
  File "./tools/gyp/pylib/gyp/xcode_emulation.py", line 234, in _GetSdkBaseDir
    raise Exception('Error %d running xcode-select' % job.returncode)
Exception: Error 2 running xcode-select
make -C out BUILDTYPE=Release V=1
make[1]: Nothing to be done for `all'.
ln -fs out/Release/node node
python tools/install.py install 
installing /usr/local/n/versions/0.8.7/include/node/ares.h
installing /usr/local/n/versions/0.8.7/include/node/ares_version.h
installing /usr/local/n/versions/0.8.7/include/node/uv.h
installing /usr/local/n/versions/0.8.7/include/node/v8-debug.h
installing /usr/local/n/versions/0.8.7/include/node/v8-preparser.h
installing /usr/local/n/versions/0.8.7/include/node/v8-profiler.h
installing /usr/local/n/versions/0.8.7/include/node/v8-testing.h
installing /usr/local/n/versions/0.8.7/include/node/v8.h
installing /usr/local/n/versions/0.8.7/include/node/v8stdint.h
installing /usr/local/n/versions/0.8.7/include/node/eio-emul.h
installing /usr/local/n/versions/0.8.7/include/node/ev-emul.h
installing /usr/local/n/versions/0.8.7/include/node/node.h
installing /usr/local/n/versions/0.8.7/include/node/node_buffer.h
installing /usr/local/n/versions/0.8.7/include/node/node_object_wrap.h
installing /usr/local/n/versions/0.8.7/include/node/node_version.h
installing /usr/local/n/versions/0.8.7/include/node/uv-private/eio.h
installing /usr/local/n/versions/0.8.7/include/node/uv-private/ev.h
installing /usr/local/n/versions/0.8.7/include/node/uv-private/ngx-queue.h
installing /usr/local/n/versions/0.8.7/include/node/uv-private/tree.h
installing /usr/local/n/versions/0.8.7/include/node/uv-private/uv-unix.h
installing /usr/local/n/versions/0.8.7/include/node/uv-private/uv-win.h
installing /usr/local/n/versions/0.8.7/share/man/man1/node.1
installing /usr/local/n/versions/0.8.7/bin/node
Traceback (most recent call last):
  File "tools/install.py", line 225, in <module>
    run(sys.argv[:])
  File "tools/install.py", line 220, in run
    if cmd == 'install': return files(install)
  File "tools/install.py", line 195, in files
    action(['out/Release/node'], 'bin/node')
  File "tools/install.py", line 74, in install
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 74, in <lambda>
    def install(paths, dst): map(lambda path: try_copy(path, dst), paths)
  File "tools/install.py", line 66, in try_copy
    return shutil.copy2(source_path, target_path)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 127, in copy2
    copyfile(src, dst)
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/shutil.py", line 81, in copyfile
    with open(src, 'rb') as fsrc:
IOError: [Errno 2] No such file or directory: 'out/Release/node'
make: *** [install] Error 1

Why aren't you using pkg files anyway?

n permissions errors

I've installed n and various nodes, but now I'm getting the following errors whenever I attempt to install a new node:

xerxes:$ n latest
/usr/local/bin/node
cp: cannot remove ./wafadmin/Options.py': Permission denied cp: cannot remove./wafadmin/Scripting.py': Permission denied
cp: cannot remove ./wafadmin/Runner.py': Permission denied cp: cannot remove./wafadmin/TaskGen.py': Permission denied
cp: cannot remove ./wafadmin/Task.py': Permission denied cp: cannot remove./wafadmin/py3kfixes.py': Permission denied
cp: cannot remove ./wafadmin/__init__.py': Permission denied cp: cannot remove./wafadmin/Constants.py': Permission denied
cp: cannot remove ./wafadmin/pproc.py': Permission denied cp: cannot remove./wafadmin/Utils.py': Permission denied
cp: cannot remove ./wafadmin/Environment.py': Permission denied cp: cannot remove./wafadmin/Tools/unittestw.py': Permission denied
cp: cannot remove ./wafadmin/Tools/python.py': Permission denied cp: cannot remove./wafadmin/Tools/winres.py': Permission denied
cp: cannot remove ./wafadmin/Tools/suncxx.py': Permission denied cp: cannot remove./wafadmin/Tools/compiler_d.py': Permission denied
cp: cannot remove ./wafadmin/Tools/gdc.py': Permission denied cp: cannot remove./wafadmin/Tools/xlcxx.py': Permission denied
cp: cannot remove ./wafadmin/Tools/ar.py': Permission denied cp: cannot remove./wafadmin/Tools/compiler_cxx.py': Permission denied
cp: cannot remove ./wafadmin/Tools/cc.py': Permission denied cp: cannot remove./wafadmin/Tools/init.py': Permission denied
cp: cannot remove ./wafadmin/Tools/icc.py': Permission denied cp: cannot remove./wafadmin/Tools/preproc.py': Permission denied
cp: cannot remove ./wafadmin/Tools/ccroot.py': Permission denied cp: cannot remove./wafadmin/Tools/dmd.py': Permission denied
cp: cannot remove ./wafadmin/Tools/libtool.py': Permission denied cp: cannot remove./wafadmin/Tools/gnu_dirs.py': Permission denied
cp: cannot remove ./wafadmin/Tools/osx.py': Permission denied cp: cannot remove./wafadmin/Tools/gas.py': Permission denied
cp: cannot remove ./wafadmin/Tools/xlc.py': Permission denied cp: cannot remove./wafadmin/Tools/intltool.py': Permission denied
cp: cannot remove ./wafadmin/Tools/compiler_cc.py': Permission denied cp: cannot remove./wafadmin/Tools/nasm.py': Permission denied
cp: cannot remove ./wafadmin/Tools/icpc.py': Permission denied cp: cannot remove./wafadmin/Tools/config_c.py': Permission denied
cp: cannot remove ./wafadmin/Tools/gxx.py': Permission denied cp: cannot remove./wafadmin/Tools/cxx.py': Permission denied
cp: cannot remove ./wafadmin/Tools/gcc.py': Permission denied cp: cannot remove./wafadmin/Tools/suncc.py': Permission denied
cp: cannot remove ./wafadmin/Tools/d.py': Permission denied cp: cannot remove./wafadmin/Tools/node_addon.py': Permission denied
cp: cannot remove ./wafadmin/Tools/gob2.py': Permission denied cp: cannot remove./wafadmin/Tools/misc.py': Permission denied
cp: cannot remove ./wafadmin/ansiterm.py': Permission denied cp: cannot remove./wafadmin/Node.py': Permission denied
cp: cannot remove ./wafadmin/Build.py': Permission denied cp: cannot remove./wafadmin/Configure.py': Permission denied
cp: cannot remove ./wafadmin/Logs.py': Permission denied cp: cannot remove./node/wafadmin/Options.py': Permission denied
cp: cannot remove ./node/wafadmin/Scripting.py': Permission denied cp: cannot remove./node/wafadmin/Runner.py': Permission denied
cp: cannot remove ./node/wafadmin/TaskGen.py': Permission denied cp: cannot remove./node/wafadmin/Task.py': Permission denied
cp: cannot remove ./node/wafadmin/py3kfixes.py': Permission denied cp: cannot remove./node/wafadmin/init.py': Permission denied
cp: cannot remove ./node/wafadmin/Constants.py': Permission denied cp: cannot remove./node/wafadmin/pproc.py': Permission denied
cp: cannot remove ./node/wafadmin/Utils.py': Permission denied cp: cannot remove./node/wafadmin/Environment.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/unittestw.py': Permission denied cp: cannot remove./node/wafadmin/Tools/python.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/winres.py': Permission denied cp: cannot remove./node/wafadmin/Tools/suncxx.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/compiler_d.py': Permission denied cp: cannot remove./node/wafadmin/Tools/gdc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/xlcxx.py': Permission denied cp: cannot remove./node/wafadmin/Tools/ar.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/compiler_cxx.py': Permission denied cp: cannot remove./node/wafadmin/Tools/cc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/__init__.py': Permission denied cp: cannot remove./node/wafadmin/Tools/icc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/preproc.py': Permission denied cp: cannot remove./node/wafadmin/Tools/ccroot.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/dmd.py': Permission denied cp: cannot remove./node/wafadmin/Tools/libtool.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/gnu_dirs.py': Permission denied cp: cannot remove./node/wafadmin/Tools/osx.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/gas.py': Permission denied cp: cannot remove./node/wafadmin/Tools/xlc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/intltool.py': Permission denied cp: cannot remove./node/wafadmin/Tools/compiler_cc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/nasm.py': Permission denied cp: cannot remove./node/wafadmin/Tools/icpc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/config_c.py': Permission denied cp: cannot remove./node/wafadmin/Tools/gxx.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/cxx.py': Permission denied cp: cannot remove./node/wafadmin/Tools/gcc.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/suncc.py': Permission denied cp: cannot remove./node/wafadmin/Tools/d.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/node_addon.py': Permission denied cp: cannot remove./node/wafadmin/Tools/gob2.py': Permission denied
cp: cannot remove ./node/wafadmin/Tools/misc.py': Permission denied cp: cannot remove./node/wafadmin/ansiterm.py': Permission denied
cp: cannot remove ./node/wafadmin/Node.py': Permission denied cp: cannot remove./node/wafadmin/Build.py': Permission denied
cp: cannot remove ./node/wafadmin/Configure.py': Permission denied cp: cannot remove./node/wafadmin/Logs.py': Permission denied

xerxes:$ n 0.7.8 node
/usr/local/bin/node
cp: cannot remove ./wafadmin/Options.py': Permission denied cp: cannot remove./wafadmin/Scripting.py': Permission denied
cp: cannot remove ./wafadmin/Runner.py': Permission denied cp: cannot remove./wafadmin/TaskGen.py': Permission denied
cp: cannot remove ./wafadmin/Task.py': Permission denied cp: cannot remove./wafadmin/py3kfixes.py': Permission denied
cp: cannot remove ./wafadmin/__init__.py': Permission denied cp: cannot remove./wafadmin/Constants.py': Permission denied
cp: cannot remove ./wafadmin/pproc.py': Permission denied cp: cannot remove./wafadmin/Utils.py': Permission denied
cp: cannot remove ./wafadmin/Environment.py': Permission denied cp: cannot remove./wafadmin/Tools/unittestw.py': Permission denied
cp: cannot remove ./wafadmin/Tools/python.py': Permission denied cp: cannot remove./wafadmin/Tools/winres.py': Permission denied
cp: cannot remove `./wafadmin/Tools/suncxx.py': Permission denied
... et cetera.

cd: 294: can't cd to node-v0.4.1

getting this message when trying to upgrade to v0.4.1 using n. nothing has changed, the perms should be fine. just started getting it. ne ideas?

some issues on ubuntu 10.10

hey there. just installed a fresh ubuntu 10.10 with build-essential and libssl-dev (for node). i downloaded the 0.4.0 - zip of n and did "sudo make install". then i added N_PREFIX to my .bashrc --> "/home/sdepold/local". running "n latest" did the following:

cd: 294: can't cd to node-v0.4.0

then i did "cd /home/sdepold/local/n/" and "n latest". now the build process for node started and ended with: "cp: kann Verzeichnis „/usr/local/include/node“ nicht anlegen: Keine Berechtigung" (unable to create folder foo, no privilege).

after that i tried "n use 0.4.0" and got the following output:

/usr/local/bin/n: 294: Bad substitution

when i go into the folder /home/sdepold/local/n/versions/0.4.0/bin/ and run the node command everything works fine

node v0.5.1 breaks the source code location path

Since 0.5.1 the location of the source is http://nodejs.org/dist/v0.5.1/node-v0.5.1.tar.gz

n exits with this error:

gzip: stdin: not in gzip format
tar: Child returned status 1
tar: Error is not recoverable: exiting now

which is understandable since:

$ cat node-v0.5.1.tar.gz 
<html>
<head><title>404 Not Found</title></head>
<body bgcolor="white">
<center><h1>404 Not Found</h1></center>
<hr><center>nginx</center>
</body>
</html>

Oops.

v0.6.19 broken

@visionmedia n is currently broken with v0.6.19. Reason being that the nodejs server has renamed the files as RC.
node-v0.6.19-RC1.tar.gz

root@chaos2:/usr/local/n# n stable
/usr/local/bin/node
######################################################################## 100.0%
rm: cannot remove `node-v0.6.19.tar.gz': No such file or directory
Error: installation failed
  node version 0.6.19 does not exist,
  n failed to fetch the tarball,
  or tar failed. Try a different
  version or view /tmp/n.log to view
  error details.

This breaks n, but I'm inclined to think that this is an issue for nodejs directly since they monkeyed with the names of files in their directory!
see it here:
http://nodejs.org/dist/v0.6.19/

Also, should n stable only grab even versions? :)

Adam

ImportError: No module named Scripting

I've installed 0.6.6 with n and I'm getting this error when trying to build node-serialport. Any ideas?

Traceback (most recent call last):
File "/opt/local/bin/node-waf", line 14, in
import Scripting
ImportError: No module named Scripting

node 0.6.6
npm 1.1.0-beta-4

Thanks!

Can't run npm

I did a sudo n 0.6.7 and then can't use the normal npm anymore. Trying sudo n npm 0.6.7 results in

% sudo n npm 0.6.7
/usr/local/bin/n: line 151: test: npm: integer expression expected
######################################################################## 100.0%
Error: installation failed
  node version npm does not exist,
  n failed to fetch the tarball,
  or tar failed. Try a different
  version or view /tmp/n.log to view
  error details.

cd: 297: can't cd to node-0.4.9

Anytime you install a new version of node, a cd fires prior to the wget/tar step. This causes the compile step to wait forever.

Workaround: run install again after it successfully downloads the file

Option to install HEAD

I think it would be great to be able to install or update the HEAD version directly off GitHub.

npm -g installs within /usr/local/n, but isn't in the PATH

I installed n with make install. I then installed node 0.6.8 and now I've installed forever using npm install forever -g.

The problem is that npm installed forever in /usr/local/n/versions/0.6.8/bin, but by default my PATH isn't extended to include this dir.

Doesn't it make sense to have a "current" symlinked folder in /usr/local/n, then include /usr/local/n/current/bin folder in your PATH so that files in the /usr/local/n/current/bin are executable globally?

0.6.18-RC's are listed

It seems that the RC's are now listed in the node.js code repo, however they seem to have started using a format with RC added to the end: node-v0.6.18-RC1.tar.gz
found here: http://nodejs.org/dist/v0.6.18/

This causes the following error:

######################################################################## 100.0%
rm: node-v0.6.18.tar.gz: No such file or directory
Error: installation failed
  node version 0.6.18 does not exist,
  n failed to fetch the tarball,
  or tar failed. Try a different
  version or view /tmp/n.log to view
  error details.

'n v0.6.5' does not seem to install npm

The latest 0.6.5 includes the npm package manager. When I install it directly, npm works fine, however when I use 'n' to install 0.6.5, the npm command is not available.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.