ImportError: No module named Scripting #48

aliasone opened this Issue Dec 25, 2011 · 13 comments


None yet

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


cwoelk commented Feb 1, 2012

To workaround this you probably can link the wafadmin directory from the correct version to /usr/local/lib/node.
I.E from within the latter directory with: ln -s /usr/local/n/versions/0.6.6/wafadmin/


I'm also having this issue with 0.6.9


cwoelk, your suggestion worked, thanks!

However you need to run ln -s /usr/local/n/versions/0.6.6/wafadmin (i.e. without the trailing slash)

@vgrichina vgrichina added a commit to vgrichina/n that referenced this issue Feb 3, 2012
@vgrichina vgrichina Fix for #48 ImportError: No module named Scripting
Creating link for wafadmin folder in $N_PREFIX/lib/node/

I too am having this problem, however I think the fix vgrichina provided has one issue: It will work the first time it creates the symlink, but if you switch around node versions, it complains that the symlink already exists.


Here's an ugly script that adds the proper symlink:

# find the current version of node.js
NODE_VERSION=`node -v | sed s/^v//`

# find for the current version of node under the lib/node/wafadmin folder (it might be somewhere else though)
SCRIPTING=`find $SEARCHROOT -name 2>/dev/null | grep $NODE_VERSION | grep "lib/node/wafadmin"`
# Needless to say, this is a really inefficient and fragile script.  
# It could be a bit more efficient if we didn't have to search the whole filesystem.

# find the wafadmin directory by getting the directory that is in

# find the directory that node-waf is in 
NODE_WAF=`which node-waf`
NODE_DIR=`dirname node-waf`

# create a symlink to the wafadmin directory that is relative to node-waf 
ln -s $WAFADMIN $NODE_DIR/../lib/node/wafadmin

The problem is that it needs to recursively copy lib/node and lib/node_modules
Why doesn't n use symlinks instead of copy?
You'll need to remove symlinks too.
And use current instead of the specific version

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

  # remove "v"

  # activate

  for link = $NPREFIX
  if test -e $N_PREFIX/lib/nod; then
      rm $N
  if test -d $dir; then
    for PATH in bin/node bin/node-waf bin/npm lib/node lib/node_modules
      echo $N_PREFIX/$PATH
      if test -e $N_PREFIX/$PATH; then
        rm $N_PREFIX/$PATH
      ln -s $N_PREFIX/n/current/$PATH $N_PREFIX/$PATH

  # install
    local tarball="node-v$version.tar.gz"
    local url="$tarball"

    # >= 0.5.x
    local minor=$(echo $version | cut -d '.' -f 2)
    test $minor -ge "5" && url="$version/$tarball"

    install_tarball $version $url $config

I haven't tested this, but if it seems reasonable (and any typos need corrected) I can submit a patch

GoChime commented Mar 7, 2012

Just experienced the same problem w/ 0.6.9.


This error burns me every time I install a new Node version. I then forget about it and Google it and wind up back here... hahaha. TJ, do you have this issue?

fgnass commented Apr 26, 2012

Under Linux the trailing dot in line 146 prevents the wafadmin dir from being copied. Simply removing the dot fixes the problem but I'm not sure how cp behaves on other platforms.

@visionmedia What's the intention of that 3rd argument?

sreuter commented Jun 9, 2012

@fgnass good catch!

@visionmedia what about that dot? :-)

@tj tj closed this in deefa0d Jun 14, 2012

This was reintroduced with 0d5e1ef

@j-hannes j-hannes referenced this issue Nov 2, 2012

Update bin/n #88


+1 on getting this fixed. Very annoying!

sreuter commented Dec 12, 2012


Fix by @J-hannes works, it's the same as I did before this was reintroduced by 0d5e1ef.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment