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
ImportError: No module named Scripting
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)
ln -s /usr/local/n/versions/0.6.6/wafadmin
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 Scripting.py for the current version of node under the lib/node/wafadmin folder (it might be somewhere else though)
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
# find the directory that node-waf is in
# 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
local version=$1; shift
# remove "v"
for link = $NPREFIX
if test -e $N_PREFIX/lib/nod; then
if test -d $dir; then
for PATH in bin/node bin/node-waf bin/npm lib/node lib/node_modules
if test -e $N_PREFIX/$PATH; then
ln -s $N_PREFIX/n/current/$PATH $N_PREFIX/$PATH
# >= 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
I haven't tested this, but if it seems reasonable (and any typos need corrected) I can submit a patch
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?
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?
@fgnass good catch!
@visionmedia what about that dot? :-)
removed trailing dot on cp command. fixes #48
This was reintroduced with 0d5e1ef
+1 on getting this fixed. Very annoying!
Fix by @J-hannes works, it's the same as I did before this was reintroduced by 0d5e1ef.