Ionic Native camera plugin SourceTree GIT problem

Hi,

I am using Ionic Native Camera Plugin and when I try to commit to my GIT repo via SourceTree tool it shows me this error

> cordova-plugin-camera@2.4.1 precommit /Users/name/ionic/Frontend/project/project/plugins/cordova-plugin-camera
> npm run gen-docs && git add README.md


> cordova-plugin-camera@2.4.1 gen-docs /Users/name/ionic/Frontend/project/project/plugins/cordova-plugin-camera
> jsdoc2md --template "jsdoc2md/TEMPLATE.md" "www/**/*.js" --plugin "dmd-plugin-cordova-plugin" > README.md

sh: jsdoc2md: command not found

npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "gen-docs"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! cordova-plugin-camera@2.4.1 gen-docs: `jsdoc2md --template "jsdoc2md/TEMPLATE.md" "www/**/*.js" --plugin "dmd-plugin-cordova-plugin" > README.md`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the cordova-plugin-camera@2.4.1 gen-docs script 'jsdoc2md --template "jsdoc2md/TEMPLATE.md" "www/**/*.js" --plugin "dmd-plugin-cordova-plugin" > README.md'.
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 cordova-plugin-camera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     jsdoc2md --template "jsdoc2md/TEMPLATE.md" "www/**/*.js" --plugin "dmd-plugin-cordova-plugin" > README.md
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cordova-plugin-camera
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cordova-plugin-camera
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/name/ionic/Frontend/project/project/plugins/cordova-plugin-camera/npm-debug.log

npm ERR! Darwin 16.7.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "run" "precommit"
npm ERR! node v6.10.3
npm ERR! npm  v3.10.10
npm ERR! code ELIFECYCLE
npm ERR! cordova-plugin-camera@2.4.1 precommit: `npm run gen-docs && git add README.md`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the cordova-plugin-camera@2.4.1 precommit script 'npm run gen-docs && git add README.md'.
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 cordova-plugin-camera package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     npm run gen-docs && git add README.md
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs cordova-plugin-camera
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls cordova-plugin-camera
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/name/ionic/Frontend/project/project/plugins/cordova-plugin-camera/npm-debug.log

husky - pre-commit hook failed (add --no-verify to bypass)

If I bypass the commit hooks (verify) it works fine but this error not should occurs no?

Thanks

Also happening to me. +1

@Hanzo

I’ve found the source of the problem. I think my IDE messed up on some npm update and it ended up changing the file ./tsconfig.json. You probably has code like this:

  "include": [
      "src/**/*.ts",
      "plugins/cordova-plugin-camera/types/index.d.ts" //remove this
  ],

Remove it and make it like this:

 "include": [
      "src/**/*.ts"
  ],

And the problem is solved.

Hi @asamarcos,

My tsconfig.json is already like this:

{
  "compilerOptions": {
    "allowSyntheticDefaultImports": true,
    "declaration": false,
    "emitDecoratorMetadata": true,
    "experimentalDecorators": true,
    "lib": [
      "dom",
      "es2015"
    ],
    "module": "es2015",
    "moduleResolution": "node",
    "sourceMap": true,
    "target": "es5"
  },
  "include": [
    "src/**/*.ts" 
  ],
  "exclude": [
    "node_modules"
  ],
  "compileOnSave": false,
  "atom": {
    "rewriteTsconfig": false
  }
}

The problem persist with sourcetree :frowning:
Any idea?

@Hanzo

Look for this file: ./.git/hooks/pre-commit

Try removing it. It got there because I (my IDE) ran npm install inside cordova-plugin-camera folder.

1 Like

Webstorm did the same thing to me and this resolved it. Thanks