Search code examples
laravelnpmadminlte

Unable to run npm command after installing laravel


I have installed new larvel project with the name startNew, for the purpose of installing admin-lte I run the command

npm install

This cause a lot of errorThis error, if anyone know another route to install admin-lte in laravel 5.7 please help.


Solution

  • I installed AdminLTE in Laravel 5.6 by declaring it as a dependency in package.json

    "admin-lte": "^2.4.8",
    

    You can also use composer command, if its not working for you by following command :

    composer require "almasaeed2010/adminlte=~2.4"
    

    Reference : https://adminlte.io/docs/2.4/installation

    For you though, the problem is just with the connection. Try using different network or try to install using Ubuntu subsystems.

    //Update After running composer try this command php artisan vendor:publish --tag=adminlte

    It will publish the adminlte scripts to your path so you can use something like For CSS:

      <link rel="stylesheet" href="{{ asset('/admin-lte/bower_components/font-awesome/css/font-awesome.min.css') }}">
        <!-- Ionicons -->
        <link rel="stylesheet" href="{{ asset('/admin-lte/bower_components/Ionicons/css/ionicons.min.css') }}">
        <!-- Animate CSS -->
        <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.7.0/animate.min.css">
        <!-- Theme style -->
        <link rel="stylesheet" href="{{ asset('/admin-lte/dist/css/AdminLTE.min.css') }}">
    

    For JS:

    <script src="{{ asset('/admin-lte/bower_components/jquery/dist/jquery.min.js') }}" ></script>
    <!-- Bootstrap 3.3.7 -->
    <script src="{{ asset('/admin-lte/bower_components/bootstrap/dist/js/bootstrap.min.js') }}"></script>
    <!-- AdminLTE App -->
    <script  src="{{ asset('/admin-lte/dist/js/adminlte.min.js') }}"></script>
    

    Reference : How to integrate Admin Lte theme in Laravel 5.4

    Update: Alternate Package: packagist.org/packages/jeroennoten/laravel-adminlte