husky: GUI Git Hook fails when env defined in .npmrc
my .npmrc:
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
save-exact = true
git -c diff.mnemonicprefix=false -c core.quotepath=false -c credential.helper=sourcetree commit -q -F /var/folders/hm/n_tq5p6j7j313n28pjzvk63c0000gn/T/SourceTreeTemp.SaYrXv -a
Error: Failed to replace env in config: ${NPM_TOKEN}
at /Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:418:13
at RegExp.[Symbol.replace] (native)
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at envReplace (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:414:12)
at parseField (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:392:7)
at /Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:335:17
at Array.forEach (native)
at Conf.add (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:334:23)
at ConfigChain.addString (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/node_modules/config-chain/index.js:244:8)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v6.10.3 --silent` to unset it.
Found '/Users/chris/github/app/.nvmrc' with version <6.10.3>
Error: Failed to replace env in config: ${NPM_TOKEN}
at /Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:418:13
at RegExp.[Symbol.replace] (native)
at RegExp.[Symbol.replace] (native)
at String.replace (native)
at envReplace (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:414:12)
at parseField (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:392:7)
at /Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:335:17
at Array.forEach (native)
at Conf.add (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/lib/config/core.js:334:23)
at ConfigChain.addString (/Users/chris/.nvm/versions/node/v6.10.3/lib/node_modules/npm/node_modules/config-chain/index.js:244:8)
nvm is not compatible with the npm config "prefix" option: currently set to ""
Run `nvm use --delete-prefix v6.10.3` to unset it.
> husky - Can't find npm in PATH. Skipping precommit script in package.json
Completed successfully
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 17
I’m having the same issue with GitKraken
Why is this closed?
Facing the same issue with Sourcetree.
Because this issue was created so long ago and I closed it without commenting why (my mistake, sorry!), I would recommend opening a new issue with a link to this issue in-case it is still relevant.
I’m facing same issue as well…
Yes, why is this closed?
@lukeselbeck i’m commiting/pushing using git kraken and visual studio, there should be a way to export variables for husky
Figured out my problem. For any future peoples: I was commiting/pushing with vscode and that was giving me the above error. When I commit/push with the terminal, it works fine!