conventional-changelog / standard-version

:trophy: Automate versioning and CHANGELOG generation, with semver.org and conventionalcommits.org
ISC License
7.69k stars 794 forks source link

Package appears to be failing on windows 7 #101

Closed dptoot closed 4 years ago

dptoot commented 8 years ago

I am running standard-version on windows 7, Node 6.4,0 NPM 3.10.7. I am using it behind GitHub Enterprise but it works fine when run from Linux.

Any ideas on what may be going on here? It generates CHANGELOG just fine but then fails.

I have added the debug info. I had to remove some company and user names from paths. Apologies.

dptoot commented 8 years ago
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli   'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'release' ]
2 info using npm@3.10.7
3 info using node@v6.4.0
4 verbose run-script [ 'prerelease', 'release', 'postrelease' ]
5 info lifecycle chopstrap-react@0.3.0~prerelease: chopstrap-react@0.3.0
6 silly lifecycle chopstrap-react@0.3.0~prerelease: no script for prerelease, continuing
7 info lifecycle chopstrap-react@0.3.0~release: chopstrap-react@0.3.0
8 verbose lifecycle chopstrap-react@0.3.0~release: unsafe-perm in lifecycle true
9 verbose lifecycle chopstrap-react@0.3.0~release: PATH: C:\Program Files\nodejs\node_modules\npm\bin\node-gyp-bin;C:\Users\dptoot\Desktop\work\chopstrap-react\node_modules\.bin;C:\Users\dptoot\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\local\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\dptoot\bin;C:\Ruby193\bin;C:\Program Files\Common Files\Microsoft Shared\Microsoft Online Services;C:\Program Files (x86)\Common Files\Microsoft Shared\Microsoft Online Services;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;F:\work\programs\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\bin\phantomjs\bin;C:\Program Files\Git\cmd;C:\Program Files\nodejs; C;C:\Program Files\Git\usr\bin\phantomjs;C:\Users\dptoot\AppData\Roaming\npm;C:\Program Files\Git\usr\bin\vendor_perl;C:\Program Files\Git\usr\bin\core_perl
10 verbose lifecycle chopstrap-react@0.3.0~release: CWD: C:\Users\dptoot\Desktop\work\chopstrap-react
11 silly lifecycle chopstrap-react@0.3.0~release: Args: [ '/d /s /c', 'standard-version' ]
12 silly lifecycle chopstrap-react@0.3.0~release: Returned: code: 1  signal: null
13 info lifecycle chopstrap-react@0.3.0~release: Failed to exec release script
14 verbose stack Error: chopstrap-react@0.3.0 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:255: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:40: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:852:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:215:5)
15 verbose pkgid chopstrap-react@0.3.0
16 verbose cwd C:\Users\dptoot\Desktop\work\chopstrap-react
17 error Windows_NT 6.1.7601
18 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "release"
19 error node v6.4.0
20 error npm  v3.10.7
21 error code ELIFECYCLE
22 error chopstrap-react@0.3.0 release: `standard-version`
22 error Exit status 1
23 error Failed at the chopstrap-react@0.3.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 chopstrap-react 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 chopstrap-react
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls chopstrap-react
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]
stevemao commented 8 years ago

What command did you run? what does your git history look like?

Ebsy commented 8 years ago

What does you release script look like? can you post your scripts object from package.json? It's more than likely an OS issue.

dptoot commented 8 years ago

I agree that is sounds like an OS issue as it works fine in the same project when run on Linux. It looks to be failing at the commit stage of the update package.json and CHANGELOG.md. After it fails both files have been updated correctly and added to git. However there has been no commit. For what its worth I don't see any of the chalk logs in the window shell as I do in the successful Linux shell.

I could see commit permissions being an issue but there are several packages in use (gh-pages etc.) that are adding, committing, and pushing with no problem

package.json

"scripts": {
    "start": "webpack-dev-server",
    "test": "karma start",
    "test:tdd": "npm run test -- --auto-watch --no-single-run",
    "test:lint": "eslint . --ext .js --ext .jsx --ignore-path .gitignore --ignore-pattern dist --cache",
    "gh-pages": "webpack",
    "gh-pages:deploy": "gh-pages -d gh-pages",
    "gh-pages:stats": "webpack --profile --json > stats.json",
    "docs:build": "react-markdown-docgen --source ./src",
    "release": "standard-version",
    "dist": "webpack",
    "dist:min": "webpack",
    "dist:modules": "babel ./src --out-dir ./dist-modules",
    "pretest": "npm run test:lint",
    "preversion": "npm run test && npm run dist && npm run dist:min && git commit --allow-empty -am \"Update dist\"",
    "prepublish": "npm run dist:modules",
    "postpublish": "npm run gh-pages && npm run gh-pages:deploy",
    "postinstall": "node lib/post_install.js"
  },

git log (obviously standard-release was added recently so only the last few commits follow standard commit format, but again standard-release used the correctly to generate CHANGELOG on windows and linux) Apologies for some company info being changed

commit 5b4465e9f9f1be7855d3754b6bf30e52ca19fa2a
Author: James Lewis <james.lewis@company.com>
Date:   Tue Aug 30 16:59:58 2016 -0400

    chore(release): 0.4.0

commit e551515170f874aaa78981f0e2cbe6daba5d0a79
Author: James Lewis <James.Lewis@company.com>
Date:   Tue Aug 30 16:53:27 2016 -0400

    chore(build): Add standard-version package

commit 0025cf9ae7caa951c764f7f2a65dbbf16193d586
Author: Sujin-Koo <Sujin.Koo@company.com>
Date:   Tue Aug 30 16:24:48 2016 -0400

    feat(popup): Add resizable to default popup attributes

    Thanks @Sujin-Koo

commit 6679055a735349a6b99bba51d2914bfbbd46476d
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 16:11:13 2016 -0400

    Update UPGRADE.md

commit d98854dc8ae94afec817c12c096851025a954e43
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 15:40:50 2016 -0400

    Update UPGRADE.md

commit e048cb61f8de321ae3996b36839133619b8d146c
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 15:40:12 2016 -0400

    Update UPGRADE.md

commit ae81f100ec685b2b034008ad5398509e446075ea
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 15:39:17 2016 -0400

    Update UPGRADE.md

commit 34eb503bd5a925d4173857e02ddf49bd4e80a22b
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 15:38:10 2016 -0400

    Update UPGRADE.md

commit ed6f393d4c02a8b2b73ab7a3dacdfd859eac1c96
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 13:22:09 2016 -0400

    Update UPGRADE.md

commit 90d85c8b34609f09916e6bb5245e6e2dc5e82055
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 13:15:25 2016 -0400

    Update UPGRADE.md

commit c0796e4613598bda6768342a25eedee9a30ad104
Author: James Lewis <James.Lewis@company.com>
Date:   Thu Aug 18 11:36:04 2016 -0400

    Update UPGRADE.md

commit 14d4e020f5aa29dd46e3d9009fea7dd2d7023c8c
Merge: 8842f4b b833a17
Author: James Lewis <james.lewis@company.com>
Date:   Thu Aug 18 11:07:26 2016 -0400

    Merge branch 'master' of https://ghe.company.com/company/chopstrap-react

commit 8842f4b9bc50617a14d36901ec915a1c2c99149b
Author: James Lewis <james.lewis@company.com>
Date:   Thu Aug 18 11:07:01 2016 -0400

    remove automated doc build on publish
dptoot commented 8 years ago

Thanks again for the help! Its a great utility and even if I can't get it working on windows I hvae my linux machine to fall back on! Although I would like to have both. :)

stevemao commented 8 years ago

standard-version only supports the angular convention :) Also please ask questions at https://gitter.im/conventional-changelog/standard-version?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge 😄

stevemao commented 8 years ago

Looks like this is one feat(popup): Add resizable to default popup attributes, I think it should generate something. I'm not on Windows 😢

charlesaraya commented 8 years ago

Same problem here. Any clues about what the problem might be?

C:\PathTo\myApp>npm run release
 myApp@0.0.1 release C:\PathTo\myApp
 standard-version

V bumping version in package.json from 0.0.1 to 0.0.2
V outputting changes to CHANGELOG.md
V committing package.json and CHANGELOG.md
warning: LF will be replaced by CRLF in CHANGELOG.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory.

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
" "release"
npm ERR! node v5.6.0
npm ERR! npm  v3.6.0
npm ERR! code ELIFECYCLE
npm ERR! myApp@0.0.1 release: `standard-version`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the myApp@0.0.1 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 myApp 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 myApp
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls myApp
npm ERR! There is likely additional logging output above.

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

package.json

"scripts": {
    "release": "standard-version",
    "build": "babel src -o app.js",
    "test": "standard app.js",
    "start": "node app.js"
  }
dptoot commented 8 years ago

@stevemao Indeed, I too thought perhaps it was due to the previous commits not adhering to standard but as I said the Changelog is updated perfectly and as expected on Windows. It is even added to git correctly. The issue just seems to arise during the git commit stage of the process.

Tapppi commented 8 years ago

Alright, I don't have my windows workstation set up due to moving, but I'll try to get to this asap if it doesn't get solved.

Unless I'm completely mistaken, the problem is with git outputting the line ending warnings below to stderr when git add is run, making standard-version exit before git commit is run. You both probably have git config core.autocrlf set to true. That means the generated files files that have LF line endings will be checked out to the working tree with CRLF line endings in certain situations, even though they have LF line endings in your working tree.

Line ending warnings:

warning: LF will be replaced by CRLF in CHANGELOG.md.
The file will have its original line endings in your working directory.
warning: LF will be replaced by CRLF in package.json.
The file will have its original line endings in your working directory.

Here's some nice documentation on autocrlf. I personally prefer to set core.eol=LF on windows to force git to use LF line endings in projects. That also only affects your local working tree, not the repository. This also depends on your editor and other related settings.. Windows line endings are a nightmare until you find the setup just right for you.

@stevemao @bcoe @tomchentw Theoretically standard-version should probably use line endings in line with the project's git config, but that might be some work?

Tapppi commented 8 years ago

@dptoot @charlesaraya As a follow up, did you get it working and do you have any suggestions to better handle or clarify the problem in error messages/docs?

dptoot commented 8 years ago

@stevemao Sorry mate I haven't had a chance yet. I will take a look ASAP and let you know.

patrickmichalina commented 8 years ago

I added:

* text eol=lf

to the first line of my .gitattributes file and it works now

dptoot commented 8 years ago

This worked for me as well on windows.

@Tapppi It would be nice if this worked regardless of git configs. The team is made up of 50+ developers all with individual setups

patrickmichalina commented 8 years ago

@dptoot try checking in a .gitattributes file into source control, then the team would have the same local config for this project, no?

Tapppi commented 8 years ago

@dptoot I agree, it should write line endings in line with your specific core.eol, but will have to look into that.. But it's good that there's a work around from @patrickmichalina.

bcoe commented 7 years ago

@dptoot did you ever make any headway on Windows; would it be worth adding a Windows specific section to the README?

dptoot commented 7 years ago

@bcoe Nothing past the workaround from @patrickmichalina I am afraid.

bcoe commented 5 years ago

@dptoot we've had windows tests for a couple years now, is this still an issue? or can I close this.

jbottigliero commented 4 years ago

✅ Travis covers Windows. ✅ The NodeJS version from this issue is no longer supported.

Thanks all!