-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Syntax error on Windows #17
Comments
Sorry for such a late response. I don't have a Windows setup at home. I got a basic setup going and tried something real quick. Setup:
I installed istanbul globally:
Then in git bash, cmd.exe, and MSYS bash this is what I got:
Just to make sure the line in question was in the script I ran the following in git bash: $ cat `which istanbul`
#!/bin/sh
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
case `uname` in
*CYGWIN*) basedir=`cygpath -w "$basedir"`;;
esac
if [ -x "$basedir/node" ]; then
"$basedir/node" "$basedir/node_modules/istanbul/lib/cli.js" "$@"
ret=$?
else
node "$basedir/node_modules/istanbul/lib/cli.js" "$@"
ret=$?
fi
exit $ret Looks like this needs some more investigation to figure out why this is causing issues for you. I'll try to test some git extensions at work when I get a chance (it might take me a few days though). They were the reason originally #4 was opened. |
@copenhas Thanks for the response. Might be worth trying to run some of the |
I'm seeing the same issue when trying to run |
@copenhas wanted to follow-up and see if you had any updates. |
Out of curiosity, I made some investigation on this. In fact, With some reading of the code of See istanbul/run-with-cover.js#L117 for related code. So even if this is not (I'm new to node.js and not using |
I have not had a chance to look into again. I'm afraid I got caught up with work long enough to forget about this issue. I apologize. I did test out our internal git extensions (written in node and the reason I submitted #4 ), and they work on latest node.js. After reading @pallxk comment (thanks for looking into it), I looked at the Istanbul documentation here. It looks like the command is expecting a node.js javascript file and not a shell command. Perhaps instead of passing istanbul |
I've got the exact same issue, driving me crazy. The same exact code runs on my Mac w/o this error, but on Windows it just won't run. Don't have any idea where to start looking. |
@kdawg1406 I believe the difference between macOS and Windows is that macOS supports she-bang scripts, while in Windows the commands have to be wrapped up into the cmd shim. So when you pass in Per the comments above you'll find that Istanbul is actually expecting a JavaScript file as the argument and not shell script or command. I believe that's what's causing the syntax error for you. You'll need to find out what the main module file path is so you can pass it in cross platform. |
Looks like Istanbul documents it some at README.md#usage-on-windows |
@copenhas Bingo! This works for mocha on Windows:
Thank you for your outstanding support and very quick response. Best to you, Karl |
@copenhas Was able to resolve the issue using a solution similar to the solution described above. Thanks for the help. Closing the issue. |
@kdawg1406 - your solution doesn't work for me - when i use:
when i use (as you suggest): I don't understand how it can't resolve the file because i can see the file at |
@ReinsBrain Not sure, this was a long time ago, so much as changed in the toolchain. Sorry, I don't have an answer for you. |
This doesn't work for storybook. trying to debug via |
@ReinsBrain You might need to change that line to Also, this error is happening even in the Webpack project. I get it when I run from a child process started with Looks like something these libraries depend on is running this code in a way that Windows doesn't understand. Whoever wrote the original code ( |
Launching mocha on windows causes issue listed here npm/cmd-shim#17 as it expects a cmd file not a js file. Specifying full path to avoid the issue.
Launching mocha on windows causes issue listed here npm/cmd-shim#17 as it expects a cmd file not a js file. Specifying full path to avoid the issue.
This issue seems to be related to #16, and possibly to the change introduced in #4 by @copenhas.
Description
Running Windows builds on AppVeyor with MinGW and MSYS. When executing test commands of the sort,
I encounter the following error
Environments
OS:
Node/npm versions:
Notes
I am able to run other commands, such as
I tried to track down where this line
basedir=$(dirname "$(echo "$0" | sed -e 's,\\,/,g')")
occurs in source code. The only place I found was in this dependency, which includes it at line 135 when creating the Windows shim.
I am not able to test whether reverting the line in question fixes the problem, as I do not have access to a Windows machine.
Note that the commands in question run without error on both Mac OS X and Linux Ubuntu, so this is a Windows specific error.
Similar bugs:
Note that the above issues have all been filed post release of
v2.0.2
which included Swap out the slashes for msysgit bash support #4.The text was updated successfully, but these errors were encountered: