Tweet: Mike Bostock recently tweeted:
If you like making maps in Illustrator, TopoJSON 1.6.9 supports conversion to SVG. No code
required! https://github.com/mbostock/topojson/blob/master/bin/topojson-svg
——Mike Bostock (#mbostock) 30 Avril 2014
Cool !
Topojson version: on my terminal, I checked the version...
$topojson --version
>1.6.11
$node --version
>v0.10.25
Seems good.
Topojson-svg trial: so I gave it a shoot...
curl -o uk.topo.json 'http://bost.ocks.org/mike/map/uk.json' #get an online topoJSON file
topojson-svg -o output.svg uk.topo.json #this fails
Error: I get a corrupt .svg file together with this ugly error message
fs.js:393
binding.close(fd, makeCallback(callback));
^
TypeError: Bad argument
at Object.fs.close (fs.js:393:11)
at Object.<anonymous> (/home/yug/local/lib/node_modules/topojson/bin/topojson-svg:85:32)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Function.Module.runMain (module.js:497:10)
at startup (node.js:119:16)
at node.js:902:3
Question: How to process to successfully use topojson-svg ?
Edit: also occured with recently installed local (non-global) /node_module :
npm install topojson #locally install topojson.js & topojson-svg
curl -o uk.topo.json 'http://bost.ocks.org/mike/map/uk.json' #get an online topoJSON file
node_modules/.bin/topojson-svg -o output.svg uk.topo.json #this fails
Fixed on github within 4minutes after reporting the issue.
Will be available within hours/days on npm, with topojson v.1.6.12+
Related
Can we change helper configuration options on the fly from a test? I saw the Dynamic configuration settings, gave the below command
npx codeceptjs run --override '{ "helpers": {"Protractor": {"browser": "firefox"}}}'
but when i run at i get the below error
undefined:1
{helpers:
^
SyntaxError: Unexpected token h in JSON at position 1
at JSON.parse (<anonymous>)
at Command.module.exports (D:\Finlevit_Codecept_Cucumber\node_modules\codeceptjs\lib\command\run.js:21:33)
at Command.listener (D:\Finlevit_Codecept_Cucumber\node_modules\commander\index.js:315:8)
at Command.emit (events.js:311:20)
at Command.parseArgs (D:\Finlevit_Codecept_Cucumber\node_modules\commander\index.js:651:12)
at Command.parse (D:\Finlevit_Codecept_Cucumber\node_modules\commander\index.js:474:21)
at Object.<anonymous> (D:\Finlevit_Codecept_Cucumber\node_modules\codeceptjs\bin\codecept.js:228:9)
at Module._compile (internal/modules/cjs/loader.js:1158:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1178:10)
at Module.load (internal/modules/cjs/loader.js:1002:32)
Can someone help me?
Looks like you use Windows with CMD tool.
That tool works with strings in double quotes. Don't forget to escape JSON double quotes with \"
npx codeceptjs run --override "{ \"helpers\": {\"Protractor\": {\"browser\": \"firefox\"}}}"
Or you can try shell/linux builder.
i am trying to move my current Kitura Dev setup into a real running environment by first moving it into a Docker Container to later migrate it to a Cloud Provider.
However while trying to build my Docker Setup for Kitura i run into problems i did not find any proper solution how to fix these.
I am Building my docker Container from The instructions from this page
https://www.kitura.io/docs/deploying/docker.html
But i am also using SwiftKuery with MySQL in the package.
My Docker Tools file looks like the following
FROM ibmcom/swift-ubuntu:5.0.2
##FROM swift:5.0.2
LABEL maintainer="IBM Swift Engineering at IBM Cloud"
LABEL Description="Template Dockerfile that extends the ibmcom/swift-ubuntu image."
# We can replace this port with what the user wants
EXPOSE 8080 1024 1025
# Default user if not provided
ARG bx_dev_user=root
ARG bx_dev_userid=1000
# Install system level packages
RUN apt-get update && apt-get dist-upgrade -y
##RUN apt-get update && apt-get install -y sudo libcurl4-openssl-dev openssl libssl-dev pkg-config libmysqlclient-dev
# Add utils files
ADD https://raw.githubusercontent.com/IBM-Swift/swift-ubuntu-docker/master/utils/tools-utils.sh /swift-utils/tools-utils.sh
ADD https://raw.githubusercontent.com/IBM-Swift/swift-ubuntu-docker/master/utils/common-utils.sh /swift-utils/common-utils.sh
RUN chmod -R 555 /swift-utils
# Create user if not root
RUN if [ "$bx_dev_user" != root ]; then useradd -ms /bin/bash -u $bx_dev_userid $bx_dev_user; fi
# Make password not required for sudo.
# This is necessary to run 'tools-utils.sh debug' script when executed from an interactive shell.
# This will not affect the deploy container.
RUN echo "$bx_dev_user ALL=NOPASSWD: ALL" > /etc/sudoers.d/user && \
chmod 0440 /etc/sudoers.d/user
#Install some further SSL related flaws
##RUN find / -name libssl.so.1.1 -type f -print
# Bundle application source & binaries
COPY . /swift-project
I get the following error
[5/24] Compiling Swift Module 'SwiftKueryMySQL' (3 sources)
[6/24] Compiling Swift Module 'KituraContracts' (9 sources)
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "shim.h"
^
/swift-project/.build-ubuntu/checkouts/SwiftKueryMySQL/Sources/CMySQL/shim.h:3:10: error: 'mysql.h' file not found
#include <mysql.h>
^
/swift-project/.build-ubuntu/checkouts/SwiftKueryMySQL/Sources/SwiftKueryMySQL/MySQLConnection.swift:21:8: error: could not build C module 'CMySQL'
import CMySQL
^
after using this commands
docker build -t myapp-build -f Dockerfile-tools .
The First one still works
docker run -v $PWD:/swift-project -w /swift-project myapp-build /swift-utils/tools-utils.sh build release
Error Appears while Building the Container
Any one has an idea what i could do to fix this issue ... ?
UPDATE:
I tried one provided suggestion to add a .swift-build-linux file
with one entry
swift build -Xcc -I/usr/include/mysql/
Into the source files of my project .
up on running the command:
docker run -v $PWD:/swift-project -w /swift-project myapp-build /swift-utils/tools-utils.sh build release
It seems to pick it up as you can see below... but still i run into the same issue :(
Current folder: /swift-project
Command: build
Build configuration: release
Build folder: /swift-project/.build-ubuntu
Compiling the project...
Build configuration: release
Custom build command: swift build -Xcc -I/usr/include/mysql/££
warning: you may be able to install mysqlclient using your system-packager:
apt-get install libmysqlclient-dev
[1/27] Compiling agentcore ibmras/common/Logger.cpp
[2/27] Compiling agentcore ibmras/common/MemoryManager.cpp
[3/27] Compiling agentcore ibmras/common/Properties.cpp
[4/27] Compiling agentcore ibmras/common/LogManager.cpp
[5/26] Compiling Swift Module 'SwiftKueryMySQL' (3 sources)
[6/26] Compiling Swift Module 'KituraContracts' (9 sources)
[7/26] Compiling Swift Module 'CloudFoundryEnv' (6 sources)
[8/26] Compiling CHTTPParser utils.c
[9/26] Linking ./.build-ubuntu/x86_64-unknown-linux/release/libagentcore.so
[10/26] Compiling CHTTPParser http_parser.c
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "shim.h"
^
/swift-project/.build-ubuntu/checkouts/SwiftKueryMySQL/Sources/CMySQL/shim.h:3:10: error: 'mysql.h' file not found
#include <mysql.h>
^
/swift-project/.build-ubuntu/checkouts/SwiftKueryMySQL/Sources/SwiftKueryMySQL/MySQLConnection.swift:21:8: error: could not build C module 'CMySQL'
import CMySQL
^
Kais-MacBook-Pro:beautylivery_server_mqsql kaibaier$ docker run -v $PWD:/swift-project -w /swift-project myapp-build /swift-utils/tools-utils.sh build release
Current folder: /swift-project
Command: build
Build configuration: release
Build folder: /swift-project/.build-ubuntu
Compiling the project...
Build configuration: release
Custom build command: swift build -Xcc -I/usr/include/mysql/
warning: you may be able to install mysqlclient using your system-packager:
apt-get install libmysqlclient-dev
[1/33] Compiling CHTTPParser http_parser.c
[2/39] Compiling CHTTPParser utils.c
[3/65] Compiling Swift Module 'TypeDecoder' (2 sources)
[4/65] Compiling Swift Module 'Socket' (3 sources)
[5/65] Compiling Swift Module 'Signals' (1 sources)
[6/65] Compiling Swift Module 'Logging' (3 sources)
[7/65] Compiling Swift Module 'KituraTemplateEngine' (1 sources)
[8/65] Compiling Swift Module 'Cryptor' (11 sources)
[9/65] Compiling memplugin MemoryPlugin.cpp
[10/65] Compiling Swift Module 'LoggerAPI' (1 sources)
[11/65] Compiling hcapiplugin APIConnector.cpp
[12/65] Linking ./.build-ubuntu/x86_64-unknown-linux/release/libmemplugin.so
[13/65] Compiling envplugin envplugin.cpp
[14/65] Linking ./.build-ubuntu/x86_64-unknown-linux/release/libhcapiplugin.so
[15/65] Compiling cpuplugin cpuplugin.cpp
[16/65] Compiling Swift Module 'SwiftKuery' (49 sources)
[17/65] Compiling Swift Module 'KituraContracts' (9 sources)
[18/65] Compiling Swift Module 'HeliumLogger' (2 sources)
[19/65] Compiling Swift Module 'SSLService' (2 sources)
[20/65] Compiling Swift Module 'Health' (3 sources)
[21/65] Compiling Swift Module 'FileKit' (1 sources)
[22/65] Compiling Swift Module 'Configuration' (5 sources)
[23/65] Compiling agentcore ibmras/monitoring/connector/configuration/ConfigurationConnector.cpp
[24/65] Linking ./.build-ubuntu/x86_64-unknown-linux/release/libenvplugin.so
[25/65] Linking ./.build-ubuntu/x86_64-unknown-linux/release/libcpuplugin.so
[26/65] Compiling agentcore ibmras/monitoring/connector/ConnectorManager.cpp
[27/65] Compiling agentcore ibmras/monitoring/agent/threads/WorkerThread.cpp
[28/65] Compiling agentcore ibmras/monitoring/agent/threads/ThreadPool.cpp
[29/65] Compiling agentcore ibmras/monitoring/agent/SystemReceiver.cpp
[30/65] Compiling agentcore ibmras/monitoring/agent/BucketList.cpp
[31/65] Compiling agentcore ibmras/monitoring/agent/Bucket.cpp
[32/65] Compiling Swift Module 'CloudFoundryEnv' (6 sources)
[33/65] Compiling agentcore ibmras/monitoring/agent/Agent.cpp
[34/65] Compiling agentcore ibmras/monitoring/Plugin.cpp
[35/65] Compiling agentcore ibmras/common/util/sysUtils.cpp
[36/65] Compiling agentcore ibmras/common/util/strUtils.cpp
[37/65] Compiling agentcore ibmras/common/util/LibraryUtils.cpp
[38/65] Compiling agentcore ibmras/common/util/FileUtils.cpp
[39/65] Compiling agentcore ibmras/common/port/linux/Thread.cpp
[40/65] Compiling Swift Module 'SwiftKueryMySQL' (3 sources)
[41/65] Compiling agentcore ibmras/common/port/linux/Process.cpp
[42/65] Compiling agentcore ibmras/common/port/ThreadData.cpp
<module-includes>:1:10: note: in file included from <module-includes>:1:
#include "shim.h"
^
/swift-project/.build-ubuntu/checkouts/SwiftKueryMySQL/Sources/CMySQL/shim.h:3:10: error: 'mysql.h' file not found
#include <mysql.h>
^
/swift-project/.build-ubuntu/checkouts/SwiftKueryMySQL/Sources/SwiftKueryMySQL/MySQLConnection.swift:21:8: error: could not build C module 'CMySQL'
import CMySQL
^
UPDATE :
It seems to work after i added this line in my Dockerfile-tools . :
RUN apt-get update && apt-get install -y sudo libmysqlclient-dev
... but now i get a new error i first have to investigate ...
[19/20] Compiling Swift Module 'Beautylivery_Server_New' (1 sources) [20/20] Linking ./.build-ubuntu/x86_64-unknown-linux/release/Beautylivery_Server_New clang-7: error: unable to execute command: Bus error clang-7: error: linker command failed due to signal (use -v to see invocation) <unknown>:0: error: link command failed with exit code 254 (use -v to see invocation)
UPDATE - Resolution:
Ok i added the entry
swift build -Xcc -I/usr/include/mysql/
to the new created .swift-build-linux file in the root directory in my project. (previously i had a small spelling mistake in the line).
Now i was able to pass this step of the Dockerisation process ... :)
UPDATE - NEW Problem:
Hello Together, i was running in a new problem related to the tutorial and this is to run the conatainer after building it: As i assume it is a different topic, i have raised a new question:
Run Kitura Docker Image causes libmysqlclient.so.18 Error
its is that up on running the container, i get an error message:
error while loading shared libraries: libmysqlclient.so.18: cannot open shared object file: No such file or directory
Thanks a lot for the Help !
The problem here is that the ibmcom/swift-ubuntu:5.0.2 image is built on top of Ubuntu 14.04. The version of libmysqlclient-dev supplied with 14.04 does not include the pkg-config information that allows the Swift compiler to find the headers without help.
There are two solutions to this problem:
1: You could add -Xcc -I/usr/include/mysql/ arguments to the swift build command. Either:
replace the command you are executing in the build container with swift build -Xcc -I/usr/include/mysql/, or
if you'd like to keep using the tools-utils.sh script, you can create a file in your project called .swift-build-linux which contains a single line: swift build -Xcc -I/usr/include/mysql/ - this will be picked up by the tools-utils.sh script when it runs the build.
2: You can replace your base images with FROM swift:5.0.2 (for the build image) and FROM swift:5.0.2-slim (for the run image) - these are the official Swift-maintained images which are based on Ubuntu 18.04, and as of the Swift 5.0.2 release, provide a 'slim' image similar to ibmcom's 'runtime' image.
Note that these images do not bundle the libssl-dev or libcurl4-openssl-dev dependencies, so you will need to include those in your Dockerfile-tools.
I'm running into a problem attempting to upload the "blink" app onto the motes. I can't seem to run the command make telosb reinstall bsl,/dev/ttUSB0 or make telosb reinstall while in the apps/Blink directory, which is preventing me from moving on with my project. I've tried as a user, superuser, and as root. I've outlined below the responses from variable commands. [Running Ubuntu 16.04, TinyOS 2.1.2, ncc version 1.4.2, nescc version 1.3.6]
(A)With root and the make telosb command I get back:
mkdir -p build/telosb
compiling BlinkAppC to a telosb binary
ncc -o build/telosb/main.exe -Os -fnesc-separator=__ -Wall -Wshadow -Wnesc-all -target=telosb -fnesc-cfile=build/telosb/app.c -board= -DDEFINED_TOS_AM_GROUP=0x22 -DIDENT_APPNAME=\"BlinkAppC\" -DIDENT_USERNAME=\"root\" -DIDENT_HOSTNAME=\"liam-Latitude-E\" -DIDENT_USERHASH=0x9236fe46L -DIDENT_TIMESTAMP=0x59384a62L -DIDENT_UIDHASH=0xdc08609fL BlinkAppC.nc -lm
compiled BlinkAppC to build/telosb/main.exe
2538 bytes in ROM
56 bytes in RAM
msp430-objcopy --output-target=ihex build/telosb/main.exe build/telosb/main.ihex
writing TOS image
(B)With regular user and the make telosb command I get back:
mkdir -p build/telosb
/bin/sh: 1: cannot create build/telosb/ident_flags.txt: Permission denied
/home/liam/tinyos-main/support/make/ident_flags.extra:13: recipe for target 'ident_cache' failed
make: *** [ident_cache] Error 2
(C)With a super user and the sudo make telosb command I get back:
make: *** No rule to make target 'telosb'. Stop.
(D)With root and the make telosb reinstall command I get back:
cp build/telosb/main.ihex build/telosb/main.ihex.out
found mote on /dev/ttyUSB0 (using bsl,auto)
installing telosb binary using bsl
tos-bsl --telosb -c /dev/ttyUSB0 -r -e -I -p build/telosb/main.ihex.out
MSP430 Bootstrap Loader Version: 1.39-goodfet-8
Mass Erase...
Transmit default password ...
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
MSP430 Bootstrap Loader Version: 1.39-goodfet-8
Mass Erase...
Transmit default password ...
Invoking BSL...
Transmit default password ...
Current bootstrap loader version: 1.61 (Device ID: f16c)
Changing baudrate to 38400 ...
Traceback (most recent call last):
File "/usr/bin/tos-bsl", line 1918, in <module>
main(0);
File "/usr/bin/tos-bsl", line 1843, in main
speed=speed,
File "/usr/bin/tos-bsl", line 1218, in actionStartBSL
self.actionChangeBaudrate(speed) #change baudrate
File "/usr/bin/tos-bsl", line 1345, in actionChangeBaudrate
self.serialport.setBaudrate(baudrate)
AttributeError: 'Serial' object has no attribute 'setBaudrate'
/home/liam/tinyos-main/support/make/msp/bsl.extra:45: recipe for target 'program' failed
make: *** [program] Error 1
(E)Whereas with a regular user and make telosb reinstall I get back:
cp build/telosb/main.ihex build/telosb/main.ihex.out
cp: cannot create regular file 'build/telosb/main.ihex.out': Permission denied
/home/liam/tinyos-main/support/make/msp/msp.rules:92: recipe for target 'setid' failed
make: *** [setid] Error 1
I have been all over the internet and online forums and haven't found a fix yet. I researched around (D) and found that perhaps python 2 might have changed the name of 'setBaudRate' variable. I'm not sure how to change that either.
Thank you for your time and help!
edit: added ncc and nescc versions.
This stack overflow answer is applicable to TinyOS.
So it turns out that pyserial 3.0.1 is not compatible with the TinyOS app, Blink. I'm fairly certain that pyserial 3.0.1 came with the package for TinyOS. To fix this, use the command sudo pip install "pySerial>=2.0,<=2.99999". For me, it kicked back:
The directory '/home/liam/.cache/pip/http' or its parent directory is not owned by the current user and the cache has been disabled. Please check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
The directory '/home/liam/.cache/pip' or its parent directory is not owned by the current user and caching wheels has been disabled. check the permissions and owner of that directory. If executing pip with sudo, you may want sudo's -H flag.
Collecting pySerial<=2.99999,>=2.0
Installing collected packages: pySerial
Found existing installation: pyserial 3.0.1
DEPRECATION: Uninstalling a distutils installed project (pySerial) has been deprecated and will be removed in a future version. This is due to the fact that uninstalling a distutils project will only partially uninstall the project.
Uninstalling pyserial-3.0.1:
Successfully uninstalled pyserial-3.0.1
Successfully installed pySerial-2.7
But the blink app still uploaded and worked fine.
I'm tryin to create a bower.json file.
I'd normally run bower init which would create the .json file.
Now I'm getting this error when I run bower init
/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:54
throw err;
^
Error: EACCES: permission denied, open '/Users/jason.dee/.config/configstore/bower-github.json'
You don't have access to this file.
at Error (native)
at Object.fs.openSync (fs.js:634:18)
at Object.fs.readFileSync (fs.js:502:33)
at Object.create.all.get (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:35:26)
at Object.Configstore (/usr/local/lib/node_modules/bower/lib/node_modules/configstore/index.js:28:44)
at readCachedConfig (/usr/local/lib/node_modules/bower/lib/config.js:19:23)
at defaultConfig (/usr/local/lib/node_modules/bower/lib/config.js:11:12)
at Object.<anonymous> (/usr/local/lib/node_modules/bower/lib/index.js:16:32)
at Module._compile (module.js:541:32)
at Object.Module._extensions..js (module.js:550:10)
MacBook-Pro:Ang-js-starter jason.dee$
Try:
sudo chown -R <user>:<user> /home/<user>/.config/configstore
example => sudo chown -R prappo:prappo /home/prappo/.config/configstore
then,
bower init
bower install <package>
I recently started building iOS apps using Cordova and I’ve hit a roadblock. After installing nodeJS, git and cordova (with sudo), I created my first app in the Documents folder of my user account.
The first run went perfectly. Everything worked, and adding my dev account to Xcode helped my app to run on the device. I decided I’d spice things up a bit by adding a “before_prepare” hook called 001_c.js in <appName>/hooks/before_prepare folder. This is how the hook begins:
//This is where nodeJS exists
#!/usr/local/bin node
console.log("Changing config");
var fs = require('fs');
var path = require('path');
var rootdir = process.argv[2];
//and so on
When I now build the app, I get this error:
pc295786:master kellster$ cordova build ios Running command:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
/Users/kellster/documents/apps/master Error: spawn EACCES
at exports._errnoException (util.js:746:11)
at ChildProcess.spawn (child_process.js:1155:11)
at Object.exports.spawn (child_process.js:988:9)
at Object.exports.spawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:104:31)
at runScriptViaChildProcessSpawn (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:188:23)
at runScript (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:131:16)
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:114:20
at _fulfilled (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:787:54)
at self.promiseDispatch.done (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:816:30)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:749:13)
To troubleshoot, I changed the first line of the hook script from
#!/usr/local/bin node
to
#! node
(Because this worked on Windows. node was in global scope). But, this resulted in an ENOENT error:
pc295786:master kellster $ cordova build ios Running command:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
/Users/kellster/documents/apps/master Error: Hook failed with error
code ENOENT:
/Users/kellster/documents/apps/master/hooks/before_prepare/001_c.js
at /usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/hooks/HooksRunner.js:194:23
at _rejected (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:797:24)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:823:30
at Promise.when (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:1035:31)
at Promise.promise.promiseDispatch (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:741:41)
at /usr/local/lib/node_modules/cordova/node_modules/q/q.js:557:44
at flush (/usr/local/lib/node_modules/cordova/node_modules/q/q.js:108:17)
at process._tickCallback (node.js:355:11)
at Function.Module.runMain (module.js:503:11)
at startup (node.js:129:16)
How do I get this to build? I’d appreciate any suggestions I could try.
Some things to note:
(In my desperation, ) I tried running the following commands, because the "EACCES" type of error. But none of them seemed to have any kind of effect on the result. The build was still failing.
sudo chmod 777 “/Users/kellster/documents/apps/master"
sudo chmod 777 “/usr/local/lib”
sudo chmod 777 "/usr/local/bin/"
chmod 777 "/Users/kellster/documents/apps/master/platforms/"
sudo chmod a+rwx "/Users/kellster/Documents/apps/Master/hooks/before_prepare/001_c.js"
sudo chmod a+rwx "/Users/kellster/Documents/apps/Master/"
sudo chown -R kellster /usr/local/lib/node_modules/cordova
2) Node is installed in
/usr/local/bin
Old answer: #!/usr/local/bin node -> better #!/usr/bin/env node
Updated answer: do not use spaces for referencing node executable instead use:
#!/usr/local/bin/node
Also chmod your script: For example:
chmod 777 hooks/before_prepare/onde.js
where onde.js it is your script. If you're on Mac(my case) or Linux, then your .js must on chmod 777 to avoid EACCES errors.