安装Composer后,它运行良好,Laravel创建了所有文件夹,并正确启动:
php artisan serve
现在,当我尝试:
laravel new mypro
它不会创建vendor
文件夹。当我尝试:
php artisan serve
它说:
php artisan serve
PHP Warning: require(/mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/../vendor/autoload.php): failed to open stream: No such file or directory in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/autoload.php on line 17
PHP Fatal error: require(): Failed opening required '/mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/../vendor/autoload.php' (include_path='.:/usr/share/php') in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog4/bootstrap/autoload.php on line 17
我复制文件夹供应商后说:
php artisan serve
PHP Fatal error: Class 'Illuminate\Notifications\NotificationServiceProvider' not found in /mnt/PROJECTS/[3]_PROCOM/[6]_PHP_Learning/Laravel_1/blog3/vendor/laravel/framework/src/Illuminate/Foundation/ProviderRepository.php on line 146
[Symfony\Component\Debug\Exception\FatalErrorException]
Class 'Illuminate\Notifications\NotificationServiceProvider' not found
答案 0 :(得分:1)
请运行命令
,而不是复制供应商文件夹composer install
在laravel的项目目录中
答案 1 :(得分:0)
尝试了来自不同来源的多种解决方案后,对我而言唯一有效的方法是升级PHP版本。
答案 2 :(得分:0)
我遇到了同样的问题。发生这种情况是因为作曲家无法安装composer.json文件中指定的依赖项。尝试运行
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical"
tools:context=".CalculatorActivity">
<FrameLayout
android:id="@+id/frameLayout"
android:layout_width="match_parent"
android:layout_height="80dp"
android:orientation="vertical"
android:padding="16dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:text="1+1"
android:textSize="32sp" />
</FrameLayout>
<GridLayout
android:id="@+id/gridLayout"
android:layout_width="match_parent"
android:layout_height="0dp"
android:columnCount="7"
android:rowCount="6"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/frameLayout">
<Button
style="@style/CalculatorButtonOp"
android:text="("
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text=")"
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text="1/x"
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text="mc"
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text="m+"
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text="m-"
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text="mr"
android:textAllCaps="false" />
<Button
style="@style/CalculatorButtonOp"
android:text="x^2" />
<Button
style="@style/CalculatorButtonOp"
android:text="x^3" />
<Button
style="@style/CalculatorButtonOp"
android:text="x^y" />
<Button
style="@style/CalculatorButtonOp"
android:text="C" />
<Button
style="@style/CalculatorButtonOp"
android:text="/" />
<Button
style="@style/CalculatorButtonOp"
android:text="x" />
<Button
style="@style/CalculatorButtonOp"
android:text="AC" />
<Button
style="@style/CalculatorButtonOp"
android:text="x!" />
<Button
style="@style/CalculatorButtonOp"
android:text="x^(1/2)" />
<Button
style="@style/CalculatorButtonOp"
android:text="x^(1/y)" />
<Button
style="@style/CalculatorButton"
android:text="7" />
<Button
style="@style/CalculatorButton"
android:text="8" />
<Button
style="@style/CalculatorButton"
android:text="9" />
<Button
style="@style/CalculatorButtonOp"
android:text="-" />
<Button
style="@style/CalculatorButtonOp"
android:text="e" />
<Button
style="@style/CalculatorButtonOp"
android:text="ln" />
<Button
style="@style/CalculatorButtonOp"
android:text="log" />
<Button
style="@style/CalculatorButton"
android:text="4" />
<Button
style="@style/CalculatorButton"
android:text="5" />
<Button
style="@style/CalculatorButton"
android:text="6" />
<Button
style="@style/CalculatorButtonOp"
android:text="+" />
<Button
style="@style/CalculatorButtonOp"
android:text="sin" />
<Button
style="@style/CalculatorButtonOp"
android:text="cos" />
<Button
style="@style/CalculatorButtonOp"
android:text="tan" />
<Button
style="@style/CalculatorButton"
android:text="1" />
<Button
style="@style/CalculatorButton"
android:text="2" />
<Button
style="@style/CalculatorButton"
android:text="3" />
<Button
style="@style/CalculatorButton"
android:layout_rowSpan="2"
android:background="@color/colorPrimary"
android:text="="
android:textColor="@android:color/white" />
<Button
style="@style/CalculatorButtonOp"
android:text="lnv" />
<Button
style="@style/CalculatorButtonOp"
android:text="Rad" />
<Button
style="@style/CalculatorButtonOp"
android:text="π" />
<Button
style="@style/CalculatorButton"
android:text="0" />
<Button
style="@style/CalculatorButton"
android:text="00" />
<Button
style="@style/CalculatorButton"
android:text="." />
</GridLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
如果这不能解决问题,请确保已安装以下PHP模块php-mbstring php-dom
要安装此扩展,请在终端中运行以下命令
composer install
一旦安装完成
尝试在项目根文件夹中再次运行命令
sudo apt-get install php-mbstring php-dom
因此,如果上述方法不起作用,您也可以尝试使用此命令
composer install
有关此线程的更多解决方案。 Laravel 5 Failed opening required bootstrap/../vendor/autoload.php
答案 3 :(得分:-1)
尝试手动安装sudo apt-get install php5.6-mbstring