Angular 2 issue:typings:command not found

所以这可能会成为一个非常基本的问题,但它已经困扰了我好几天,实际上并没有find解决办法。

我正在使用npm从命令行安装types代码,它看起来运行良好,但是之后我input了任何input命令,它说这个命令不存在!

它是这样的:

Kevyns-MacBook-Pro:~ kevynquiros$ sudo npm install typings --global Password: /Users/kevynquiros/npm/bin/typings -> /Users/kevynquiros/npm/lib/node_modules/typings/dist/bin.js typings@1.0.4 /Users/kevynquiros/npm/lib/node_modules/typings ├── listify@1.0.0 ├── xtend@4.0.1 ├── wordwrap@1.0.0 ├── archy@1.0.0 ├── minimist@1.2.0 ├── any-promise@1.3.0 ├── bluebird@3.4.0 ├── chalk@1.1.3 (supports-color@2.0.0, escape-string-regexp@1.0.5, ansi-styles@2.2.1, has-ansi@2.0.0, strip-ansi@3.0.1) ├── columnify@1.5.4 (strip-ansi@3.0.1, wcwidth@1.0.1) ├── update-notifier@0.7.0 (is-npm@1.0.0, xdg-basedir@2.0.0, semver-diff@2.1.0, ansi-align@1.0.0, boxen@0.5.1, configstore@2.0.0, latest-version@2.0.0) └── typings-core@1.0.1 (array-uniq@1.0.2, thenify@3.2.0, zip-object@0.1.0, popsicle-status@2.0.0, graceful-fs@4.1.4, popsicle-retry@3.1.0, throat@2.0.2, lockfile@1.0.1, promise-finally@2.2.0, string-template@1.0.0, strip-bom@2.0.0, sort-keys@1.1.2, make-error-cause@1.1.0, debug@2.2.0, has@1.0.1, rc@1.1.6, object.pick@1.1.2, configstore@2.0.0, parse-json@2.2.0, invariant@2.2.1, detect-indent@4.0.0, mkdirp@0.5.1, touch@1.0.0, is-absolute@0.2.5, popsicle-proxy-agent@2.0.1, rimraf@2.5.2, typescript@1.8.7, popsicle@6.2.0) 

然后,这是发生了什么事情:

 Kevyns-MacBook-Pro:~ kevynquiros$ typings search tape -bash: typings: command not found 

请帮忙!

       

网上收集的解决方案 "Angular 2 issue:typings:command not found"

至于你的问题中的cmd输出,types包安装在/Users/kevynquiros/npm/bin/typings 。 您需要将该文件夹添加到您的PATH

一种方法是:

  • 创build“或编辑”文件/Users/kevynquiros/.bash_profile
  • 在该文件中,添加一行:

    export PATH=${PATH}:/Users/kevynquiros/npm/bin/

  • closures并重新打开terminal ,它应该工作。

尝试使用npm install typings -g