Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

ImportError: No module named Scripting #48

Closed
aliasone opened this Issue · 13 comments

12 participants

aliasone Carsten Woelk Vladimir Grichina Sean Aaron Evans GoChime JP Richardson Felix Gnass Sascha Reuter Matt Robenolt Stephen Melrose TJ Holowaychuk
aliasone

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!

Carsten Woelk

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/

Vladimir Grichina

I'm also having this issue with 0.6.9

Vladimir Grichina

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)

Vladimir Grichina vgrichina referenced this issue from a commit in vgrichina/n
Vladimir Grichina vgrichina Fix for #48 ImportError: No module named Scripting
Creating link for wafadmin folder in $N_PREFIX/lib/node/
ca0930a
Sean

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.

Aaron Evans

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 Scripting.py for the current version of node under the lib/node/wafadmin folder (it might be somewhere else though)
SEARCHROOT=/
SCRIPTING=`find $SEARCHROOT -name Scripting.py 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 Scripting.py is in
WAFADMIN=`dirname $SCRIPTING`

# 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
Aaron Evans

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=$@
  check_current_version

  # remove "v"
  version=${version#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
    do
      echo $N_PREFIX/$PATH
      if test -e $N_PREFIX/$PATH; then
        rm $N_PREFIX/$PATH
      fi  
      ln -s $N_PREFIX/n/current/$PATH $N_PREFIX/$PATH
  done

  # install
  else
    local tarball="node-v$version.tar.gz"
    local url="http://nodejs.org/dist/$tarball"

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

    install_tarball $version $url $config
  fi
}

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

GoChime

Just experienced the same problem w/ 0.6.9.

JP Richardson

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?

Felix Gnass

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?

Sascha Reuter

@fgnass good catch!

@visionmedia what about that dot? :-)

TJ Holowaychuk tj closed this in deefa0d
Matt Robenolt

This was reintroduced with 0d5e1ef

j-hannes j-hannes referenced this issue
Closed

Update bin/n #88

Stephen Melrose

+1 on getting this fixed. Very annoying!

Sascha Reuter

+1

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
Something went wrong with that request. Please try again.