Skip to content
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

Fails on windows: error: unknown switch `m' #49

Closed
Tapppi opened this issue Jun 7, 2016 · 9 comments
Closed

Fails on windows: error: unknown switch `m' #49

Tapppi opened this issue Jun 7, 2016 · 9 comments
Labels

Comments

@Tapppi
Copy link
Member

Tapppi commented Jun 7, 2016

When I run on windows (cygwin shell, cmd and a few types of other shells), the release fails due to an unknown switch being passed to git add.

After a short skimp through the source, I suspect the problem lies in the fact that both git add and git commit are executed at the same time and the ';' separator does not work in the windows cmd, thus the git commit -m flag being passed to add. In true windows style the exec calls cmd regardless of whether I execute standard-release in bash or cmd.. Output and debug log below.

My current workaround is to just add and commit myself.

Output

$ npm run release

@1.0.0 release
standard-version

√ bumping version in package.json from 1.0.0 to 1.1.0
√ outputting changes to CHANGELOG.md
√ committing package.json and CHANGELOG.md
error: unknown switch `m'
usage: git add [options] [--] ...

-n, --dry-run         dry run
-v, --verbose         be verbose

-i, --interactive     interactive picking
-p, --patch           select hunks interactively
-e, --edit            edit current diff and apply
-f, --force           allow adding otherwise ignored files
-u, --update          update tracked files
-N, --intent-to-add   record only the fact that the path will be added later
-A, --all             add changes from all tracked and untracked files
--ignore-removal      ignore paths removed in the working tree (same as --no-all)
--refresh             don't add, only refresh the index
--ignore-errors       just skip files which cannot be added because of errors
--ignore-missing      check if - even missing - files are ignored in dry run

npm ERR! Windows_NT 6.1.7601
npm ERR! argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\Tapppi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "release"
npm ERR! node v4.4.3
npm ERR! npm v3.9.5
npm ERR! code ELIFECYCLE
npm ERR! @1.0.0 release: standard-version
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @1.0.0 release script 'standard-version'.
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 package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! standard-version
npm ERR! You can get information on how to open an issue for this project with:
npm ERR! npm bugs
npm ERR! Or if that isn't available, you can get their info via:
npm ERR! npm owner ls
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! \npm-debug.log

debug-log

0 info it worked if it ends with ok
1 verbose cli [ 'C:\Program Files (x86)\nodejs\node.exe',
1 verbose cli 'C:\Users\Tapppi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'run',
1 verbose cli 'release' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'prerelease', 'release', 'postrelease' ]
5 info lifecycle @1.1.0prerelease: @1.1.0
6 silly lifecycle @1.1.0
prerelease: no script for prerelease, continuing
7 info lifecycle @1.1.0release: @1.1.0
8 verbose lifecycle @1.1.0
release: unsafe-perm in lifecycle true
9 verbose lifecycle @1.1.0release: PATH:
10 verbose lifecycle @1.1.0
release: CWD: C:\dev
11 silly lifecycle @1.1.0release: Args: [ '/d /s /c', 'standard-version' ]
12 silly lifecycle @1.1.0
release: Returned: code: 1 signal: null
13 info lifecycle @1.1.0~release: Failed to exec release script
14 verbose stack Error: @1.1.0 release: standard-version
14 verbose stack Exit status 1
14 verbose stack at EventEmitter. (C:\Users\Tapppi\AppData\Roaming\npm\node_modules\npm\lib\utils\lifecycle.js:245:16)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at EventEmitter.emit (events.js:172:7)
14 verbose stack at ChildProcess. (C:\Users\Tapppi\AppData\Roaming\npm\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack at emitTwo (events.js:87:13)
14 verbose stack at ChildProcess.emit (events.js:172:7)
14 verbose stack at maybeClose (internal/child_process.js:827:16)
14 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:211:5)
15 verbose pkgid @1.1.0
16 verbose cwd C:\dev
17 error Windows_NT 6.1.7601
18 error argv "C:\Program Files (x86)\nodejs\node.exe" "C:\Users\Tapppi\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "run" "release"
19 error node v4.4.3
20 error npm v3.9.5
21 error code ELIFECYCLE
22 error @1.1.0 release: standard-version
22 error Exit status 1
23 error Failed at the @1.1.0 release script 'standard-version'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error standard-version
23 error You can get information on how to open an issue for this project with:
23 error npm bugs
23 error Or if that isn't available, you can get their info via:
23 error npm owner ls
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

Sorry about the silly redactions, just playing on the safe side with company stuff :)

@bcoe
Copy link
Member

bcoe commented Jun 7, 2016

@Tapppi great catch :) would be more than happy to split this into two commands so that it works in your Windows environment.

Would you like to try patching and testing? will definitely accept the commit.

@Tapppi
Copy link
Member Author

Tapppi commented Jun 7, 2016

I'll take it on shortly, great distraction from writing specs. 😂

@Tapppi
Copy link
Member Author

Tapppi commented Jun 7, 2016

I completed work on this, but seems like the tests are broken as well on windows. Windows throws happy little "Microsoft JScript compilation error" dialogs on each test. I am currently debugging this problem, but lines like shell.exec(cliPath).code.should.equal(0) pop out as possible suspects.

@Tapppi Tapppi added the bug label Jun 8, 2016
Tapppi added a commit to Tapppi/standard-version that referenced this issue Jun 8, 2016
…cution

Windows cmd doesn't support separating commands with ';'. Fix by separating
the execution of the 'git add' and 'git commit' commands.

Fixes conventional-changelog#49
Tapppi added a commit to Tapppi/standard-version that referenced this issue Jun 8, 2016
…cution

Windows cmd doesn't support separating commands with ';'. Fix by separating
the execution of the 'git add' and 'git commit' commands. Added separate
test for git add.

Fixes conventional-changelog#49
Tapppi added a commit to Tapppi/standard-version that referenced this issue Jun 8, 2016
Windows cmd doesn't support separating commands with ';'. Fix by separating
the execution of the 'git add' and 'git commit' commands. Added separate
test for git add.

Fixes conventional-changelog#49
nexdrew pushed a commit that referenced this issue Jun 8, 2016
Windows cmd doesn't support separating commands with ';'. Fix by separating
the execution of the 'git add' and 'git commit' commands. Added separate
test for git add.

Fixes #49
@patrickmichalina
Copy link

Has this not been release yet? Still seeing this on Windows..

@nexdrew
Copy link
Member

nexdrew commented Jun 15, 2016

@patrickmichalina Whoops, you're right, we did not publish a new release since #55 was merged. I will fix this shortly and let you know.

@nexdrew
Copy link
Member

nexdrew commented Jun 15, 2016

@patrickmichalina Published 2.3.1 as standard-version@next. Give that a shot and let us know if it works. I will then promote 2.3.1 to latest.

@nexdrew
Copy link
Member

nexdrew commented Jun 16, 2016

[email protected] has been promoted to latest

@patrickmichalina
Copy link

Thanks, was able to get latest, but I guess this is a different issue...

11 silly lifecycle [email protected]~release: Args: [ '/d /s /c', 'standard-version' ]
12 silly lifecycle [email protected]~release: Returned: code: 1  signal: null
13 info lifecycle [email protected]~release: Failed to exec release script
14 verbose stack Error: [email protected] release: `standard-version`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\lifecycle.js:239:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\lib\utils\spawn.js:24:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:850:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)

Still cannot try out this package. Fails after it committing the changelog.md

@Tapppi
Copy link
Member Author

Tapppi commented Jun 16, 2016

@patrickmichalina could you please open a new issue with at least the debug log and how you are running the command as this "works for me"(tm). That way I can better attempt to help you.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Development

No branches or pull requests

4 participants