Creating laravel apps without internet connection

后端 未结 2 1594
情话喂你
情话喂你 2021-01-24 16:53

Does laravel 5.1 work without internet connection? I like to create a laravel new application when i execute laravel new test (with intenet connection) it works well; but when

相关标签:
2条回答
  • 2021-01-24 17:30

    Composer 2+:

    COMPOSER_DISABLE_NETWORK=1 laravel new myapp
    

    Troubleshooting:

    1. Check your composer version: composer --version - you may have to update to the latest version with composer self-update;
    2. Check you have a global cache: echo $COMPOSER_HOME - you may have to create a ~/.composer and set export COMPOSER_HOME="${HOME}/.composer" to your ~/.bashrc or ~/.zshrc - don't forget to close and open your terminal to apply the changes;
    3. If you get this error https://repo.packagist.org could not be fully loaded (Network disabled, request canceled: https://repo.packagist.org/packages.json), package information was loaded from the local cache and may be out of date, the laravel packages are not in the global cache. Run the command with internet enabled to download the files.
    0 讨论(0)
  • 2021-01-24 17:31

    When you use the laravel installer it fetches the latest version from the server. One solution would be to initialise a Laravel project, then add it to git version control and then when offline checkout the project to a new folder. You'd have to manually choose a new app key (I think). You will also not be able to composer require or npm install any new packages while offline.

    Once you have created it though it should run offline (unless your views are sourcing assets from, say, bootstrap or jQuery CDNs).

    0 讨论(0)
提交回复
热议问题