windows git bash npm: command not found

准备学习express 发现npm命令不能在git bash中使用

Bingo@DESKTOP-19C7BJT MINGW64 ~
$ npm -v
bash: npm: command not found

上网查询得知安装完nodejs之后配置windows环境变量只能保证在命令行工具中可以使用npm,如果想在git bash中使用需要再安装一遍

  • 下载 npm
Bingo@DESKTOP-19C7BJT MINGW64 ~
$ git clone --recursive git://github.com/isaacs/npm.git

Cloning into 'npm'...
remote: Counting objects: 63481, done.
remote: Compressing objects: 100% (23/23), done.
remote: Total 63481 (delta 5), reused 0 (delta 0), pack-reused 63458
Receiving objects: 100% (63481/63481), 32.37 MiB | 399.00 KiB/s, done.
Resolving deltas: 100% (35818/35818), done.
Checking connectivity... done.
Checking out files: 100% (3096/3096), done.
  • 安装npm
Bingo@DESKTOP-19C7BJT MINGW64 ~
$ cd npm
Bingo@DESKTOP-19C7BJT MINGW64 ~/npm (latest)
$ node cli.js install npm -gf

npm WARN using --force I sure hope you know what you are doing.
D:\git\nvmw\v6.10.0\npm -> D:\git\nvmw\v6.10.0\node_modules\npm\bin\npm-cli.js
D:\git\nvmw\v6.10.0
`-- npm@4.4.1
  +-- abbrev@1.1.0
  +-- ansi-regex@2.1.1
  +-- aproba@1.1.1
  +-- cmd-shim@2.0.2
  | `-- graceful-fs@4.1.11  deduped
  +-- fs-vacuum@1.2.9
  | +-- graceful-fs@4.1.11  deduped
  | `-- rimraf@2.6.0  deduped
  +-- fs-write-stream-atomic@1.0.8
  | +-- graceful-fs@4.1.11  deduped
  | `-- readable-stream@2.2.3  deduped
  +-- fstream@1.0.10
  | +-- graceful-fs@4.1.11  deduped
  | `-- rimraf@2.6.0  deduped
  +-- glob@7.1.1
  | +-- fs.realpath@1.0.0
  | +-- inflight@1.0.6  deduped
  | +-- minimatch@3.0.3
  | | `-- brace-expansion@1.1.6
  | |   +-- balanced-match@0.4.2
  | |   `-- concat-map@0.0.1
  | `-- path-is-absolute@1.0.1
  +-- graceful-fs@4.1.11
  +-- hosted-git-info@2.2.0
  +-- inflight@1.0.6
  +-- init-package-json@1.9.4
  | +-- glob@6.0.4
  | | `-- inflight@1.0.6  deduped
  | `-- validate-npm-package-name@2.2.2
  |   `-- builtins@0.0.7
  +-- JSONStream@1.3.0
  | +-- jsonparse@1.2.0
  | `-- through@2.3.8
  +-- lazy-property@1.0.0
  +-- lockfile@1.0.3
  +-- mississippi@1.3.0
  | +-- concat-stream@1.6.0
  | | +-- readable-stream@2.2.3  deduped
  | | `-- typedarray@0.0.6
  | +-- duplexify@3.5.0
  | | +-- end-of-stream@1.0.0
  | | | `-- once@1.3.3
  | | +-- readable-stream@2.2.3  deduped
  | | `-- stream-shift@1.0.0
  | +-- end-of-stream@1.1.0
  | | `-- once@1.3.3
  | +-- flush-write-stream@1.0.2
  | | `-- readable-stream@2.2.3  deduped
  | +-- from2@2.3.0
  | | `-- readable-stream@2.2.3  deduped
  | +-- parallel-transform@1.1.0
  | | +-- cyclist@0.2.2
  | | `-- readable-stream@2.2.3  deduped
  | +-- pump@1.0.2
  | | `-- end-of-stream@1.1.0  deduped
  | +-- pumpify@1.3.5
  | | +-- duplexify@3.5.0  deduped
  | | `-- pump@1.0.2  deduped
  | +-- stream-each@1.2.0
  | | +-- end-of-stream@1.1.0  deduped
  | | `-- stream-shift@1.0.0
  | `-- through2@2.0.3
  |   +-- readable-stream@2.2.3  deduped
  |   `-- xtend@4.0.1
  +-- node-gyp@3.5.0
  | +-- glob@7.1.1  deduped
  | +-- graceful-fs@4.1.11  deduped
  | +-- minimatch@3.0.3
  | | `-- brace-expansion@1.1.6
  | |   +-- balanced-match@0.4.2
  | |   `-- concat-map@0.0.1
  | +-- nopt@3.0.6
  | | `-- abbrev@1.1.0  deduped
  | +-- npmlog@4.0.2  deduped
  | +-- osenv@0.1.4  deduped
  | +-- request@2.79.0  deduped
  | +-- rimraf@2.6.0  deduped
  | `-- which@1.2.12  deduped
  +-- nopt@4.0.1
  | +-- abbrev@1.1.0  deduped
  | `-- osenv@0.1.4
  |   +-- os-homedir@1.0.2
  |   `-- os-tmpdir@1.0.2
  +-- normalize-package-data@2.3.5
  | `-- hosted-git-info@2.2.0  deduped
  +-- npm-package-arg@4.2.0
  | `-- hosted-git-info@2.2.0  deduped
  +-- npm-registry-client@7.4.5
  | +-- concat-stream@1.5.2
  | | +-- readable-stream@2.0.6
  | | | +-- core-util-is@1.0.2
  | | | +-- isarray@1.0.0
  | | | +-- process-nextick-args@1.0.7
  | | | +-- string_decoder@0.10.31
  | | | `-- util-deprecate@1.0.2
  | | `-- typedarray@0.0.6
  | +-- graceful-fs@4.1.11  deduped
  | +-- npmlog@4.0.2  deduped
  | +-- request@2.79.0  deduped
  | `-- retry@0.10.1  deduped
  +-- npmlog@4.0.2
  | +-- are-we-there-yet@1.1.2
  | | +-- delegates@1.0.0
  | | `-- readable-stream@2.2.3  deduped
  | +-- console-control-strings@1.1.0
  | +-- gauge@2.7.2
  | | +-- aproba@1.1.1  deduped
  | | +-- console-control-strings@1.1.0  deduped
  | | +-- object-assign@4.1.0
  | | +-- signal-exit@3.0.2
  | | +-- string-width@1.0.2
  | | | +-- code-point-at@1.1.0
  | | | `-- is-fullwidth-code-point@1.0.0
  | | |   `-- number-is-nan@1.0.1
  | | +-- supports-color@0.2.0
  | | `-- wide-align@1.1.0
  | |   `-- string-width@1.0.2  deduped
  | `-- set-blocking@2.0.0
  +-- opener@1.4.3
  +-- osenv@0.1.4
  | +-- os-homedir@1.0.2
  | `-- os-tmpdir@1.0.2
  +-- read-cmd-shim@1.0.1
  | `-- graceful-fs@4.1.11  deduped
  +-- read-installed@4.0.3
  | `-- graceful-fs@4.1.11  deduped
  +-- read-package-json@2.0.4
  | +-- glob@6.0.4
  | | `-- inflight@1.0.6  deduped
  | `-- graceful-fs@4.1.11  deduped
  +-- readable-stream@2.2.3
  | +-- buffer-shims@1.0.0
  | +-- core-util-is@1.0.2
  | +-- isarray@1.0.0
  | +-- process-nextick-args@1.0.7
  | +-- string_decoder@0.10.31
  | `-- util-deprecate@1.0.2
  +-- readdir-scoped-modules@1.0.2
  | `-- graceful-fs@4.1.11  deduped
  +-- request@2.79.0
  | +-- aws-sign2@0.6.0
  | +-- aws4@1.5.0
  | +-- caseless@0.11.0
  | +-- combined-stream@1.0.5
  | | `-- delayed-stream@1.0.0
  | +-- extend@3.0.0
  | +-- forever-agent@0.6.1
  | +-- form-data@2.1.2
  | | +-- asynckit@0.4.0
  | | +-- combined-stream@1.0.5  deduped
  | | `-- mime-types@2.1.13  deduped
  | +-- har-validator@2.0.6
  | | +-- chalk@1.1.3
  | | | +-- ansi-styles@2.2.1
  | | | +-- escape-string-regexp@1.0.5
  | | | +-- has-ansi@2.0.0
  | | | | `-- ansi-regex@2.1.1  deduped
  | | | `-- supports-color@2.0.0
  | | +-- commander@2.9.0
  | | | `-- graceful-readlink@1.0.1
  | | +-- is-my-json-valid@2.15.0
  | | | +-- generate-function@2.0.0
  | | | +-- generate-object-property@1.2.0
  | | | | `-- is-property@1.0.2
  | | | +-- jsonpointer@4.0.0
  | | | `-- xtend@4.0.1
  | | `-- pinkie-promise@2.0.1
  | |   `-- pinkie@2.0.4
  | +-- hawk@3.1.3
  | | +-- boom@2.10.1
  | | | `-- hoek@2.16.3  deduped
  | | +-- cryptiles@2.0.5
  | | | `-- boom@2.10.1  deduped
  | | +-- hoek@2.16.3
  | | `-- sntp@1.0.9
  | |   `-- hoek@2.16.3  deduped
  | +-- http-signature@1.1.1
  | | +-- assert-plus@0.2.0
  | | +-- jsprim@1.3.1
  | | | +-- extsprintf@1.0.2
  | | | +-- json-schema@0.2.3
  | | | `-- verror@1.3.6
  | | |   `-- extsprintf@1.0.2  deduped
  | | `-- sshpk@1.10.1
  | |   +-- asn1@0.2.3
  | |   +-- assert-plus@1.0.0
  | |   +-- bcrypt-pbkdf@1.0.0
  | |   | `-- tweetnacl@0.14.3  deduped
  | |   +-- dashdash@1.14.1
  | |   | `-- assert-plus@1.0.0  deduped
  | |   +-- ecc-jsbn@0.1.1
  | |   | `-- jsbn@0.1.0  deduped
  | |   +-- getpass@0.1.6
  | |   | `-- assert-plus@1.0.0  deduped
  | |   +-- jodid25519@1.0.2
  | |   | `-- jsbn@0.1.0  deduped
  | |   +-- jsbn@0.1.0
  | |   `-- tweetnacl@0.14.3
  | +-- is-typedarray@1.0.0
  | +-- isstream@0.1.2
  | +-- json-stringify-safe@5.0.1
  | +-- mime-types@2.1.13
  | | `-- mime-db@1.25.0
  | +-- oauth-sign@0.8.2
  | +-- qs@6.3.0
  | +-- stringstream@0.0.5
  | +-- tough-cookie@2.3.2
  | | `-- punycode@1.4.1
  | +-- tunnel-agent@0.4.3
  | `-- uuid@3.0.1  deduped
  +-- retry@0.10.1
  +-- rimraf@2.6.0
  | `-- glob@7.1.1  deduped
  +-- sha@2.0.1
  | +-- graceful-fs@4.1.11  deduped
  | `-- readable-stream@2.2.3  deduped
  +-- sorted-union-stream@2.1.3
  | +-- from2@1.3.0
  | | `-- readable-stream@1.1.14
  | |   +-- core-util-is@1.0.2
  | |   +-- isarray@0.0.1
  | |   `-- string_decoder@0.10.31
  | `-- stream-iterate@1.1.1
  +-- strip-ansi@3.0.1
  | `-- ansi-regex@2.1.1  deduped
  +-- update-notifier@2.0.0
  | +-- boxen@1.0.0
  | | +-- ansi-align@1.1.0
  | | | `-- string-width@1.0.2
  | | |   +-- code-point-at@1.1.0
  | | |   `-- is-fullwidth-code-point@1.0.0
  | | |     `-- number-is-nan@1.0.1
  | | +-- camelcase@4.0.0
  | | +-- chalk@1.1.3  deduped
  | | +-- cli-boxes@1.0.0
  | | +-- string-width@2.0.0
  | | | `-- is-fullwidth-code-point@2.0.0
  | | +-- term-size@0.1.1
  | | | `-- execa@0.4.0
  | | |   +-- cross-spawn-async@2.2.5
  | | |   | +-- lru-cache@4.0.2
  | | |   | | +-- pseudomap@1.0.2
  | | |   | | `-- yallist@2.0.0
  | | |   | `-- which@1.2.12  deduped
  | | |   +-- is-stream@1.1.0
  | | |   +-- npm-run-path@1.0.0
  | | |   | `-- path-key@1.0.0  deduped
  | | |   +-- object-assign@4.1.1
  | | |   +-- path-key@1.0.0
  | | |   `-- strip-eof@1.0.0
  | | `-- widest-line@1.0.0
  | |   `-- string-width@1.0.2
  | |     +-- code-point-at@1.1.0
  | |     `-- is-fullwidth-code-point@1.0.0
  | |       `-- number-is-nan@1.0.1
  | +-- chalk@1.1.3
  | | +-- ansi-styles@2.2.1
  | | +-- escape-string-regexp@1.0.5
  | | +-- has-ansi@2.0.0
  | | | `-- ansi-regex@2.1.1  deduped
  | | `-- supports-color@2.0.0
  | +-- configstore@3.0.0
  | | +-- dot-prop@4.1.0
  | | | `-- is-obj@1.0.1
  | | +-- graceful-fs@4.1.11  deduped
  | | +-- unique-string@1.0.0
  | | | `-- crypto-random-string@1.0.0
  | | +-- write-file-atomic@1.3.1  deduped
  | | `-- xdg-basedir@3.0.0  deduped
  | +-- is-npm@1.0.0
  | +-- latest-version@3.0.0
  | | `-- package-json@3.0.0
  | |   +-- got@6.7.1
  | |   | +-- create-error-class@3.0.2
  | |   | | `-- capture-stack-trace@1.0.0
  | |   | +-- duplexer3@0.1.4
  | |   | +-- get-stream@3.0.0
  | |   | +-- is-redirect@1.0.0
  | |   | +-- is-retry-allowed@1.1.0
  | |   | +-- is-stream@1.1.0
  | |   | +-- lowercase-keys@1.0.0
  | |   | +-- safe-buffer@5.0.1
  | |   | +-- timed-out@4.0.1
  | |   | +-- unzip-response@2.0.1
  | |   | `-- url-parse-lax@1.0.0
  | |   |   `-- prepend-http@1.0.4
  | |   +-- registry-auth-token@3.1.0
  | |   | `-- rc@1.1.6
  | |   |   +-- deep-extend@0.4.1
  | |   |   +-- minimist@1.2.0
  | |   |   `-- strip-json-comments@1.0.4
  | |   `-- registry-url@3.1.0
  | |     `-- rc@1.1.6
  | |       +-- deep-extend@0.4.1
  | |       +-- minimist@1.2.0
  | |       `-- strip-json-comments@1.0.4
  | +-- lazy-req@2.0.0
  | +-- semver-diff@2.1.0
  | `-- xdg-basedir@3.0.0
  +-- uuid@3.0.1
  +-- validate-npm-package-name@3.0.0
  | `-- builtins@1.0.3
  +-- which@1.2.12
  | `-- isexe@1.1.2
  `-- write-file-atomic@1.3.1
    `-- graceful-fs@4.1.11  deduped
  • 验证
Bingo@DESKTOP-19C7BJT MINGW64 ~/npm (latest)
$ npm -v

4.4.1

参考:
http://blog.csdn.net/haidaochen/article/details/7257655

  • 4
    点赞
  • 14
    收藏
    觉得还不错? 一键收藏
  • 5
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 5
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值