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

Does not work after npm i and package config #42

Closed
maboiteaspam opened this issue Oct 26, 2015 · 29 comments
Closed

Does not work after npm i and package config #42

maboiteaspam opened this issue Oct 26, 2015 · 29 comments

Comments

@maboiteaspam
Copy link

Hi!

TLDR; IRFM, ran it, then tried to run git cz, it failed with an unfortunate but epic error,

D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

The longer story

Running windows 7 with node and npm such

D:\work\MyBlog\C\c2-bin>npm -v
2.11.3

D:\work\MyBlog\C\c2-bin>node -v
v0.12.7

I have run D:\work\MyBlog\C\c2-bin>npm install -g commitizen,
then D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact

Then i configured my local package.json file to add

  ,"config": {
    "commitizen": {
      "path": "node_modules/cz-conventional-changelog"
    }
  }

Where did i get it wrong ?

Thanks !


D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact
Attempting to initialize using the npm package cz-conventional-changelog
Error: A previous adapter is already configured. Use --force to override

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact --force
Attempting to initialize using the npm package cz-conventional-changelog
npm WARN using --force I sure hope you know what you are doing.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression
[email protected] node_modules\cz-conventional-changelog
└── [email protected]
{this.config was unexpected at this time.

D:\work\MyBlog\C\c2-bin>  "C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\node_modules\.bin\\node.exe"  "C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\node
_modules\.bin\\..\json\lib\json.js" -I -f D:\work\MyBlog\C\c2-bin\package.json -e 'if(!this.config) {this.config={};}; if(!this.config.commitizen) { this.config.commitizen={};}
; this.config.commitizen.path="./node_modules/cz-conventional-changelog"'

D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

D:\work\MyBlog\C\c2-bin>

@jimthedev
Copy link
Member

Hi! Sorry to hear you're having trouble. Can you try using a this in your package.json?

  ,"config": {
    "commitizen": {
      "path": "./node_modules/cz-conventional-changelog"
    }
  }

@maboiteaspam
Copy link
Author

How about having a console argument for the matter of that value ?

I have a case where i want to run same cz for many instances, i don t feel like i want to duplicate it everywhere. That seems inappropriate to me.

I ve gone through your sources, and find quickly you are not using any helper for that.
Any matter here ?

  // Get cli args
  let rawGitArgs = process.argv.slice(2, process.argv.length);

This said, i ran into similar issue on my box too,

maboiteaspam [21:12:08] c2-bin (master) # npm install -g commitizen
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
/home/maboiteaspam/bin/git-cz -> /home/maboiteaspam/lib/node_modules/commitizen/bin/git-cz
/home/maboiteaspam/bin/commitizen -> /home/maboiteaspam/lib/node_modules/commitizen/bin/commitizen
[email protected] /home/maboiteaspam/lib/node_modules/commitizen
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected]
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected])
maboiteaspam [21:15:12] c2-bin (master) # commitizen init cz-conventional-changelog --save --save-exact
Attempting to initialize using the npm package cz-conventional-changelog
Error: A previous adapter is already configured. Use --force to override
maboiteaspam [21:26:33] c2-bin (master) # git cz
/home/maboiteaspam/lib/node_modules/commitizen/src/commitizen/adapter.js:162
    throw err;
          ^
Error: ENOENT, no such file or directory '/home/maboiteaspam/Bureau/C/c2-bin/node_modules/cz-conventional-changelog'
    at Error (native)
    at Object.fs.lstatSync (fs.js:792:18)
    at resolveAdapterPath (/home/maboiteaspam/lib/node_modules/commitizen/src/commitizen/adapter.js:115:11)
    at getPrompter (/home/maboiteaspam/lib/node_modules/commitizen/src/commitizen/adapter.js:92:29)
    at gitCz (/home/maboiteaspam/lib/node_modules/commitizen/src/cli/strategies/git-cz.js:48:20)
    at Object.bootstrap (/home/maboiteaspam/lib/node_modules/commitizen/src/cli/git-cz.js:24:5)
    at Object.<anonymous> (/home/maboiteaspam/lib/node_modules/commitizen/bin/git-cz.js:3:33)
    at Module._compile (module.js:460:26)
    at normalLoader (/home/maboiteaspam/lib/node_modules/commitizen/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:199:5)
    at Object.require.extensions.(anonymous function) [as .js] (/home/maboiteaspam/lib/node_modules/commitizen/node_modules/babel/node_modules/babel-core/lib/api/register/node.js:216:7)
maboiteaspam [21:26:50] c2-bin (master) # npm install -g conventional-changelog^C
maboiteaspam [21:28:03] c2-bin (master) # ^C
maboiteaspam [21:28:03] c2-bin (master) # npm i cz-conventional-changelog
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression
[email protected] node_modules/cz-conventional-changelog
└── [email protected]
maboiteaspam [21:28:19] c2-bin (master) # git cz
Error: No files added to staging! Did you forget to run git add?
maboiteaspam [21:29:46] c2-bin (master) # 

I suggest to improve the README.md to better indicate and suggest about the required first adapter,

npm i cz-conventional-changelog --save-dev --save-exact

I ll check again tomorrow on windows see.

@jimthedev
Copy link
Member

Thank you for the feedback on the README. It does need to be updated to be more clear. I have opened #27 to track the documentation changes and will make sure to include our discussion.

Let's take a look at this lines in the error log you posted. This is an important error:

maboiteaspam [21:15:12] c2-bin (master) # commitizen init cz-conventional-changelog --save --save-exact
Attempting to initialize using the npm package cz-conventional-changelog
Error: A previous adapter is already configured. Use --force to override

You had previously configured an adapter but the path was wrong. This error is trying to inform you that commitizen init will not install a new adapter and edit your package.json if you have a path already configured.

In order to tell Commitizen that it is ok to override the previous value, you must re-run the command above with the --force flag. Running with the --force flag overwrites any previous value in the package.json's config.commitizen.path and runs npm install cz-conventional-changelog --save-dev --save-exact so that you do not need to do that manually.

So, the command would be:

commitizen init cz-conventional-changelog --save --save-exact --force

By running this, you should be all set.

@maboiteaspam
Copy link
Author

ok, so i cleaned up my env here on windows, re ran,

commitizen init cz-conventional-changelog --save --save-exact

and got expected results. the new package, the new dependency.

So far, git cz, hangs, it s expected,

git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

Then update the package file such

{
  "name": "c2-bin",
  "version": "1.0.0",
  "description": "Command and Control binary for C projects.",
  "main": "index.js",
  "bin": {
    "c2-bin": "bin.js"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "maboitespam",
  "prefer": "global",
  "license": "WTF",
  "dependencies": {
    "chokidar": "^1.2.0",
    "findup-sync": "^0.3.0",
    "glob": "^5.0.15",
    "got": "^4.2.0",
    "grunt": "^0.4.5",
    "grunt-cli": "^0.1.13",
    "grunt-open": "^0.2.3",
    "inquirer": "^0.10.1",
    "minimist": "^1.2.0",
    "once": "^1.3.2",
    "resolve": "^1.1.6"
  },
  "devDependencies": {
    "cz-conventional-changelog": "^1.1.4"
  }
,"config": {
  "commitizen": {
    "path": "node_modules/cz-conventional-changelog"
  }
}
}

Still hang.

trying,

    "path": "./node_modules/cz-conventional-changelog"

same.

Also tried,

,"config": {
  "commitizen": {
    "path": ".\\node_modules\\cz-conventional-changelog"
  }

same.

I ve not gone through the source, but i d say it s missing a path.join according to the fact it worked on my linux box and this is about a stupid path resolution issue.

Still, i d like to know how you feel about passing this value as a cli parameter. if you feel not to add this, just let it know.

@maboiteaspam
Copy link
Author

before i forget, again i really want to suggest about improving the README. Yesterday I really felt this one was hard to read. I d suggest to get something close to those examples https://github.com/substack/node-browserify https://github.com/rvagg/changelog-maker with some clear identified sections about some clearly identified steps (Install, Usage ect).

@jimthedev
Copy link
Member

Did you try commitizen init cz-conventional-changelog --save --save-exact --force?

@jimthedev
Copy link
Member

Also can you confirm that you have commitizen version 2.3.0 installed?

@jimthedev
Copy link
Member

Hi there. Hope you aren't still having this problem but if you are, please provide some of the info above. If not I'll probably close it in 3 days. Obviously you can always reopen.

@maboiteaspam
Copy link
Author

Hi!

Sorry for the lag, i got absorbed into other matters.

Yes! i do have 2.3.0

npm ls commitizen -g --depth=1
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\yeoman requires bower@'~0.3.0' but will load
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\bower,
npm WARN unmet dependency which is version 1.4.1
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\yeoman requires clean-css@'~0.3.2' but will load
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\clean-css,
npm WARN unmet dependency which is version 3.3.5
C:\Users\d1m\AppData\Roaming\npm
└── [email protected]

Running
commitizen init cz-conventional-changelog --save --save-exact --force
outputs

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact --force
Attempting to initialize using the npm package cz-conventional-changelog
npm WARN using --force I sure hope you know what you are doing.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression
[email protected] node_modules\cz-conventional-changelog
└── [email protected]
{this.config was unexpected at this time.

D:\work\MyBlog\C\c2-bin>  "C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\node_modules\.bin\\node.exe"  "C:\Users\d1m\AppData\Roaming\npm\node_modules\commitize
n\node_modules\.bin\\..\json\lib\json.js" -I -f D:\work\MyBlog\C\c2-bin\package.json -e 'if(!this.config) {this.config={};}; if(!this.config.commitizen) { this.config.com
mitizen={};}; this.config.commitizen.path="./node_modules/cz-conventional-changelog"'

D:\work\MyBlog\C\c2-bin>

Then git cz

D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

D:\work\MyBlog\C\c2-bin>

Does it help ?

@maboiteaspam
Copy link
Author

And my package json is

{
  "name": "c2-bin",
  "version": "1.0.0",
  "description": "Command and Control binary for C projects.",
  "main": "index.js",
  "bin": {
    "c2-bin": "bin.js"
  },
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "keywords": [],
  "author": "maboitespam",
  "prefer": "global",
  "license": "WTF",
  "dependencies": {
    "chokidar": "^1.2.0",
    "findup-sync": "^0.3.0",
    "glob": "^5.0.15",
    "got": "^4.2.0",
    "grunt": "^0.4.5",
    "grunt-cli": "^0.1.13",
    "grunt-open": "^0.2.3",
    "inquirer": "^0.10.1",
    "minimist": "^1.2.0",
    "once": "^1.3.2",
    "resolve": "^1.1.6"
  },
  "devDependencies": {
    "cz-conventional-changelog": "^1.1.4"
  },
  "config": {
    "commitizen": {
      "path": ".\\node_modules\\cz-conventional-changelog"
    }
  }
}

BTW! How to do with this commitizen path, which is here windows format, but when i ll get back home, on linux, i will need to use a linux forward slashed path.
Can it the path format be lifted whatever is the os to make that work smoothly ?

jimthedev added a commit that referenced this issue Nov 9, 2015
The method we were using to modify json files (specifically the package.json) was overly complex for
our relatively simple use case. It also caused several issues on Windows and required a really
bizarre syntax.

Closes #42
@jimthedev
Copy link
Member

@maboiteaspam I found the problem. All tests are now passing on windows and I swapped out the json editor which seemed to have problems on windows. This is a much simpler method of editing the json and seems to perform much better on windows. If this doesn't fix your problem then please let me know.

@maboiteaspam
Copy link
Author

wouav, really cool ! Thanks a lot.

Given the commit, i will test install from the repo directly and let you know if that works fine.

@jimthedev
Copy link
Member

Sounds good!

@maboiteaspam
Copy link
Author

just in case, and because i have not seen .appveyor.yml file,

http://www.appveyor.com/

i know it s not perfect, but it can help!

testing results

D:\work\MyBlog\C\c2-bin>npm -v
2.11.3
D:\work\MyBlog\C\c2-bin>node -v
v0.12.7
D:\work\MyBlog\C\c2-bin>npm i commitizen/cz-cli -g
npm WARN addRemoteGit Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit
npm WARN addRemoteGit     at ChildProcess.exithandler (child_process.js:751:12)
npm WARN addRemoteGit     at ChildProcess.emit (events.js:110:17)
npm WARN addRemoteGit     at maybeClose (child_process.js:1015:16)
npm WARN addRemoteGit     at Socket.<anonymous> (child_process.js:1183:11)
npm WARN addRemoteGit     at Socket.emit (events.js:107:17)
npm WARN addRemoteGit     at Pipe.close (net.js:485:12)
npm WARN addRemoteGit  commitizen/cz-cli resetting remote C:\Users\d1m\AppData\Roaming\npm-cache\_git-remotes\git-github.aaakk.us.kg-commitizen-cz-cli-git-cb6b9503 because of err
or: { [Error: Command failed: git -c core.longpaths=true config --get remote.origin.url
npm WARN addRemoteGit ]
npm WARN addRemoteGit   killed: false,
npm WARN addRemoteGit   code: 1,
npm WARN addRemoteGit   signal: null,
npm WARN addRemoteGit   cmd: 'git -c core.longpaths=true config --get remote.origin.url' }
npm WARN optional dep failed, continuing [email protected]
npm WARN optional dep failed, continuing [email protected]
C:\Users\d1m\AppData\Roaming\npm\git-cz -> C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\bin\git-cz
C:\Users\d1m\AppData\Roaming\npm\commitizen -> C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\bin\commitizen
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\yeoman requires bower@'~0.3.0' but will load
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\bower,
npm WARN unmet dependency which is version 1.4.1
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\yeoman requires clean-css@'~0.3.2' but will load
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\clean-css,
npm WARN unmet dependency which is version 3.3.5
[email protected] C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected]
├── [email protected] ([email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected]
.2, [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], vinyl
[email protected], [email protected])
├── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], chokidar@1.
2.0)
└── [email protected] ([email protected], [email protected], [email protected], [email protected], [email protected], [email protected], [email protected], s
[email protected], [email protected], [email protected], [email protected])

D:\work\MyBlog\C\c2-bin>

D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save --save-exact
module.js:338
    throw err;
          ^
Error: Cannot find module '../dist/cli/commitizen.js'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\bin\commitizen.js:2:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)

: (

D:\work\MyBlog\C\c2-bin>dir C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\bin\..\
 Volume in drive C has no label.
 Volume Serial Number is D08E-2E0C

 Directory of C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen

11/09/2015  01:04 PM    <DIR>          .
11/09/2015  01:04 PM    <DIR>          ..
11/09/2015  01:04 PM                20 .npmignore
11/09/2015  01:04 PM               656 .travis.yml
11/09/2015  01:04 PM    <DIR>          bin
11/09/2015  01:04 PM               135 jsconfig.json
11/09/2015  01:04 PM             1,063 LICENSE
11/09/2015  01:05 PM    <DIR>          node_modules
11/09/2015  01:04 PM             9,873 package.json
11/09/2015  01:04 PM             7,051 README.md
               6 File(s)         18,798 bytes
               4 Dir(s)  43,178,950,656 bytes free

weird stuff is

D:\work\MyBlog\C\c2-bin>npm ls commitizen -g --depth=1

C:\Users\d1m\AppData\Roaming\npm
└── (empty)

npm ERR! code 1

D:\work\MyBlog\C\c2-bin>

with another package it works nicely

D:\work\MyBlog\C\c2-bin>npm ls showusage -g --depth=1
C:\Users\d1m\AppData\Roaming\npm
└── [email protected]

: / If i have time, i ll try to dig that, too.

@maboiteaspam
Copy link
Author

ok never mind, i ll re do manually, have not seen before : https://github.com/commitizen/cz-cli/blob/master/.npmignore

@maboiteaspam
Copy link
Author

nah, i don't know.

I mean, i m not used to es6 stack with babel, and now i m facing weird errors like this

commitizen init cz-conventional-changelog --save --save-exact
C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\dist\cli\commitizen.js:1
(function (exports, require, module, __filename, __dirname) { import { configL
                                                              ^^^^^^
SyntaxError: Unexpected reserved word
    at exports.runInThisContext (vm.js:73:16)
    at Module._compile (module.js:443:25)
    at Object.Module._extensions..js (module.js:478:10)
    at Module.load (module.js:355:32)
    at Function.Module._load (module.js:310:12)
    at Module.require (module.js:365:17)
    at require (module.js:384:17)
    at Object.<anonymous> (C:\Users\d1m\AppData\Roaming\npm\node_modules\commitizen\bin\commitizen.js:2:1)
    at Module._compile (module.js:460:26)
    at Object.Module._extensions..js (module.js:478:10)

in short,

npm i babel -g
npm i babel-cli -g
cd commitizen
npm i -g

How about appveyor ?

@jimthedev
Copy link
Member

Ah, ok. It seems like something is messed up in your environment but I don't know exactly what it is. I would recommend removing your global packages and clearing your npm cache because something is messed up

Can you check to see if you have babel 6 installed by running babel --version. We do not yet support babel 6 so if you have babel 6 installed then you should revert to babel 5 for now.

Unfortunately, I don't know anything about appveyor. Sorry.

The commitizen workflow really should be as simple as the following:

npm install -g [email protected]
mkdir my-javascript-project
cd my-javascript-project
git init
npm init --yes
commitizen init cz-conventional-changelog --save-dev
git add .
git cz

If it isn't then something is likely conflicting (eg. babel 6 installed globally) or something is screwed up in your environment.

@maboiteaspam
Copy link
Author

Hi !

Thanks for help. Indeed much easier.

I hope you can take a moment to check about appveyor, it s very much like travis, but for windows.

This said i m sorry to report some failures : /

git cz still ain t working, for the same reasons.
Also, now, the package json formatting is blown out after the adapter is installed,

see,

D:\work\MyBlog\C\c2-bin>npm install -g commitizen
[lots of things]

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save-dev --force
Attempting to initialize using the npm package cz-conventional-changelog
npm WARN using --force I sure hope you know what you are doing.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression
[email protected] node_modules\cz-conventional-changelog
└── [email protected]



D:\work\MyBlog\C\c2-bin>git cz
module.js:338
    throw err;
          ^
Error: Cannot find module 'D:\work\MyBlog\C\c2-bin\node_modules\commitizen\bin\git-cz'
    at Function.Module._resolveFilename (module.js:336:15)
    at Function.Module._load (module.js:278:25)
    at Function.Module.runMain (module.js:501:10)
    at startup (node.js:129:16)
    at node.js:814:3



D:\work\MyBlog\C\c2-bin>npm ls commitizen -g --depth=1
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\yeoman requires bower@'~0.3.0' but will load
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\bower,
npm WARN unmet dependency which is version 1.4.1
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\yeoman requires clean-css@'~0.3.2' but will load
npm WARN unmet dependency C:\Users\d1m\AppData\Roaming\npm\node_modules\clean-css,
npm WARN unmet dependency which is version 3.3.5
C:\Users\d1m\AppData\Roaming\npm
└── [email protected]

And the package json looks likes this now : (

{"name":"c2-bin","version":"1.0.0","description":"Command and Control binary for C projects.","main":"index.js","bin":{"c2-bin":"bin.js"},"scripts":{"test":"echo \"Error: no test specified\" && exit 1"},"keywords":[],"author":"maboitespam","prefer":"global","license":"WTF","dependencies":{"chokidar":"^1.2.0","findup-sync":"^0.3.0","glob":"^5.0.15","got":"^4.2.0","grunt":"^0.4.5","grunt-cli":"^0.1.13","grunt-open":"^0.2.3","inquirer":"^0.10.1","minimist":"^1.2.0","once":"^1.3.2","resolve":"^1.1.6"},"devDependencies":{"cz-conventional-changelog":"^1.1.4"},"config":{"commitizen":{"path":"./node_modules/cz-conventional-changelog"}}}

@maboiteaspam
Copy link
Author

Note also i un-built babel 6 prior those steps.

and commitizen has brought in babel 5.8.29

For the records,

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save-dev
Attempting to initialize using the npm package cz-conventional-changelog
Error: A previous adapter is already configured. Use --force to override

D:\work\MyBlog\C\c2-bin>commitizen init cz-conventional-changelog --save-dev --force
Attempting to initialize using the npm package cz-conventional-changelog
npm WARN using --force I sure hope you know what you are doing.
npm WARN package.json [email protected] No repository field.
npm WARN package.json [email protected] license should be a valid SPDX license expression
[email protected] node_modules\cz-conventional-changelog
└── [email protected]

@jimthedev
Copy link
Member

@maboiteaspam I haven't been able to replicate this, but in an effort to make sure that our test coverage includes Windows I'm working on getting our tests running on appveyor.

@maboiteaspam
Copy link
Author

I wont promise, but if i can free some time at office i ll seriously dig it too.

thanks again !

@afirdousi
Copy link

Do you guys have something on this uptil now?

Here is my simple package.json

{
"name": "enterprise-config",
"description": "This is a sample Node JS Module for showing how to setup travis ci with git for enterprise Node JS modules",
"main": "src/index.js",
"scripts": {
"commit":"git-cz",
"test": "karma start",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
},
"repository": {
"type": "git",
"url": "https://github.com/afirdousi/node-npm-travis-git-integration-sample.git"
},
"keywords": [
"NodeJS",
"Travic",
"CI",
"Git",
"JavaScript",
"Module",
"Sample"
],
"author": "'Anas <'[email protected]'>",
"license": "'MIT'",
"bugs": {
"url": "https://github.com/afirdousi/node-npm-travis-git-integration-sample/issues"
},
"homepage": "https://github.com/afirdousi/node-npm-travis-git-integration-sample",
"devDependencies": {
"commitizen": "^2.4.4",
"cz-conventional-changelog": "^1.1.4",
"karma": "^0.13.15",
"karma-browserify": "^4.4.0",
"karma-chrome-launcher": "^0.2.1",
"karma-jasmine": "^0.3.6",
"semantic-release": "^6.0.3"
},
"config": {
"commitizen": {
"path": "./node_modules/cz-conventional-changelog"
}
}

}

When i try to do npm run commit

I get the following:

enterprise-config@ commit D:\git\node-npm-travis-git-integration-sample
git-cz

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" "commit"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! file C:\WINDOWS\system32\cmd.exe;
npm ERR! path C:\WINDOWS\system32\cmd.exe;
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn C:\WINDOWS\system32\cmd.exe;
npm ERR! enterprise-config@ commit: git-cz
npm ERR! spawn C:\WINDOWS\system32\cmd.exe; ENOENT
npm ERR!
npm ERR! Failed at the enterprise-config@ commit script 'git-cz'.
npm ERR! This is most likely a problem with the enterprise-config package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! git-cz
npm ERR! You can get their info via:
npm ERR! npm owner ls enterprise-config
npm ERR! There is likely additional logging output above.
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" "commit"
npm ERR! node v0.12.0
npm ERR! npm v2.5.1
npm ERR! code ELIFECYCLE

npm ERR! enterprise-config@ commit: git-cz
npm ERR! Exit status -4058
npm ERR!
npm ERR! Failed at the enterprise-config@ commit script 'git-cz'.
npm ERR! This is most likely a problem with the enterprise-config package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR! git-cz
npm ERR! You can get their info via:
npm ERR! npm owner ls enterprise-config
npm ERR! There is likely additional logging output above.

npm ERR! Please include the following file with any support request:
npm ERR! D:\git\node-npm-travis-git-integration-sample\npm-debug.log

I am also attaching my log file here
npm-semantic-cli-issues.txt

My environement:

Windows 8.1
Node : v0.12.0
NPM : 2.5.1
Commitizen : 2.4.4
cz-conventional-changelog : 1.1.4

What am I doing wrong here? Can anyone help please?

@jimthedev
Copy link
Member

@afirdousi That is odd. Unfortunately, I don't have a Windows 8.1 machine but would you mind trying to run these in powershell to see if it makes any difference?

@maboiteaspam
Copy link
Author

hi,

I ll just drop that link here, to not forget about it, until i can free time,
https://github.com/Microsoft/nodejs-guidelines

i believe it may be helpful : )

@jimthedev
Copy link
Member

Sounds good. I have appveyor tests running on Windows 2012 R2. The only one
failing is the multi line commit one which is due to the way git on Windows
formats its output.
On Mon, Nov 16, 2015 at 7:34 PM maboiteaspam [email protected]
wrote:

hi,

I ll just drop that link here, to not forget about it, until i can free
time,
https://github.com/Microsoft/nodejs-guidelines

i believe it may be helpful : )


Reply to this email directly or view it on GitHub
#42 (comment).

@jimthedev
Copy link
Member

Ok all Windows tests are now passing on appveyor. Next I will have to try to figure out if it has something to do with how we're recommending that people configure their package.json's commit script. Thanks for hanging in there.

@jimthedev jimthedev reopened this Nov 17, 2015
@maboiteaspam
Copy link
Author

Hi @jimthedev ,

amazing, i can make it work now : ) Happy.

But i need to report about something i found weird.

git cz will not work, git-cz does work here.

The steps i followed

npm rm babel-cli babel -g # just in case
npm i commitizen@latest -g --force 
npm ls commitizen -g --depth=1 # to check
commitizen init cz-conventional-changelog --save --save-exact --force

et voila : )

Will dig about adapters now !!

Thanks again.

@jimthedev
Copy link
Member

Hooray! Thanks for the feedback!
On Wed, Nov 18, 2015 at 12:33 AM maboiteaspam [email protected]
wrote:

Hi @jimthedev https://github.com/jimthedev ,

amazing, i can make it work now : ) Happy.

But i need to report about something i found weird.

git cz will not work, git-cz does work here.

The steps i followed

npm rm babel-cli babel -g # just in case
npm i commitizen@latest -g --force
npm ls commitizen -g --depth=1 # to check
commitizen init cz-conventional-changelog --save --save-exact --force

et voila : )

Will dig about adapters now !!

Thanks again.


Reply to this email directly or view it on GitHub
#42 (comment).

@maboiteaspam
Copy link
Author

kind of forgotten to close, sorry : )

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

No branches or pull requests

3 participants