【问题标题】:Commands from packages installed with yarn not found?找不到使用纱线安装的软件包中的命令?
【发布时间】:2018-12-20 17:15:35
【问题描述】:

我使用yarn 全局安装了vue-cli,但vue 给出了“找不到命令”错误。为什么会发生这种情况,我该如何解决?

一些有趣的调试信息:

$ yarn global list
yarn global v1.7.0
info "qbrt@0.2.5" has binaries:
   - qbrt
info "vue-cli@2.9.6" has binaries:
   - vue
   - vue-init
   - vue-list
info "webpack@4.16.0" has binaries:
   - webpack
Done in 0.56s.
$ ls $(yarn global bin)
$

如您所见,我的二进制文件目录似乎是空的...

【问题讨论】:

  • 你应该使用标签yarnpkg insteal of yarn。

标签: node.js npm vue.js yarnpkg


【解决方案1】:

我发现二进制文件在其他地方结束。

$ yarn global bin
/home/username/.npm-packages/bin
$ ls ~/.yarn/bin
acorn   errno        handlebars  _metalsmith   rimraf       sha.js        uglifyjs  vue-init  win-fork
atob    esparse      json5       miller-rabin  seek-bunzip  sshpk-conv    uid       vue-list  win-line-endings
cake    esvalidate   js-yaml     mkdirp        seek-table   sshpk-sign    uuid      webpack   win-spawn
coffee  extract-zip  metalsmith  qbrt          semver       sshpk-verify  vue       which

奇怪,但将 ~/.yarn/bin 添加到我的 $PATH 可以解决问题。

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2015-04-16
    • 2015-09-23
    • 2023-01-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多