dounue6984 2019-04-05 01:19
浏览 215
已采纳

将Composer bin目录添加到PATH后找不到Laravel命令

I ran sudo nano .bashrc and added

export PATH="~/.composer/vendor/bin:$PATH"

I restarted my terminal, ran laravel and received

laravel: command not found

I had run this prior to the above

composer global require laravel/installer

Also tried executing what I added to .bashrc in the terminal directly.

echo $PATH prints

/home/dev/.composer/vendor/bin:~/.composer/vendor/bin:~/.composer/vendor/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin
  • 写回答

1条回答 默认 最新

  • doqau82086 2019-04-05 02:07
    关注

    The directory that Composer uses to store global binaries can be configured, and its default value depends on your operating system. You can see what it's set to by running

    composer global config bin-dir --absolute
    

    On your machine that outputs

    /home/dev/.config/composer/vendor/bin
    

    so that's what you should add to your PATH:

    export PATH="~/.config/composer/vendor/bin:$PATH"
    

    See also:

    • Why is COMPOSER_HOME empty?, which touches on one reason why you might see ~/.composer/ on some machines and ~/.config/composer/ on others.
    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论

报告相同问题?

悬赏问题

  • ¥15 js调用html页面需要隐藏某个按钮
  • ¥15 ads仿真结果在圆图上是怎么读数的
  • ¥20 Cotex M3的调试和程序执行方式是什么样的?
  • ¥20 java项目连接sqlserver时报ssl相关错误
  • ¥15 一道python难题3
  • ¥15 牛顿斯科特系数表表示
  • ¥15 arduino 步进电机
  • ¥20 程序进入HardFault_Handler
  • ¥15 关于#python#的问题:自动化测试
  • ¥20 问题请教!vue项目关于Nginx配置nonce安全策略的问题