FEEL FREE TO CLOSE THIS OUT IF IT IS NOT A TAPE ISSUE
I am using [email protected] npm v3.8.3 and node v4.4.0 on Windows 8.1 and have the following script in my package.json
"test": "babel-node ./node_modules/.bin/tape tests/*.js",
Now when I execute npm run test from my command prompt, I get the following error
C:\Users\user\Documents\GitHub\project\node_modules\.bin\tape:2
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
^^^^^^^
SyntaxError: missing ) after argument list
at exports.runInThisContext (vm.js:53:16)
at Module._compile (module.js:373:25)
at Module._extensions..js (module.js:416:10)
at Object.require.extensions.(anonymous function) [as .js] (C:\Users\user\Documents\GitHub\project\node_
les\babel-register\lib\node.js:166:7)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Function.Module.runMain (module.js:441:10)
at C:\Users\user\Documents\GitHub\project\node_modules\babel-cli\lib\_babel-node.js:171:48
at Object.<anonymous> (C:\Users\user\Documents\GitHub\project\node_modules\babel-cli\lib\_babel-node.js:
7)
at Module._compile (module.js:409:26)
npm ERR! Windows_NT 6.3.9600
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "tes
npm ERR! node v4.4.0
npm ERR! npm v3.8.3
npm ERR! code ELIFECYCLE
npm ERR! [email protected] test: `babel-node ./node_modules/.bin/tape tests/*.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the [email protected] test script 'babel-node ./node_modules/.bin/tape tests/*.js'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the project package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! babel-node ./node_modules/.bin/tape tests/*.js
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs project
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls project
npm ERR! There is likely additional logging output above.
npm ERR! Please include the following file with any support request:
npm ERR! C:\Users\user\Documents\GitHub\project\npm-debug.log
That stack trace implies it's a babel-node issue - but also, I'm not sure babel-node (a node runner) can be used to run another node runner (tape).
Problem is because, on Windows, ./node_modules/.bin/tape is not a JavaScript file. This is neither a tape concern, nor a babel concern鈥攊t's just how npm works.
npm uses the cmd-shim to "link" binaries on Windows since symlinks are not suitable in that case. As a result, ./node_modules/.bin/tape is a shell script.
The fix, in your case, is to not reference anything in .bin as if it were a JS file. Tape, fortunately, has the -r/--require flag, so you can recreate the functionality afforded you by babel-node with the require hook and polyfill:
tape -r babel-register -r babel-polyfill tests/*.js
Most helpful comment
Problem is because, on Windows,
./node_modules/.bin/tapeis not a JavaScript file. This is neither a tape concern, nor a babel concern鈥攊t's just how npm works.npm uses the cmd-shim to "link" binaries on Windows since symlinks are not suitable in that case. As a result,
./node_modules/.bin/tapeis a shell script.The fix, in your case, is to not reference anything in
.binas if it were a JS file. Tape, fortunately, has the-r/--requireflag, so you can recreate the functionality afforded you bybabel-nodewith the require hook and polyfill: