执行命令:sail artisan migrate 时,报错:In Filesystem.php line 207: chmod(): Operation not permitted

1、执行命令:sail artisan migrate 时,报错:chmod(): Operation not permitted。如图1

图1

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$ sail artisan migrate

In Filesystem.php line 207:

  chmod(): Operation not permitted


wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$

2、运行以下命令进行重新加载文件:sail composer dump-autoload,报错:In Filesystem.php line 207: chmod(): Operation not permitted。Script @php artisan package:discover –ansi handling the post-autoload-dump event returned with error code 1。如图2

图2

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$ sail composer dump-autoload
Generating optimized autoload files
> Illuminate\Foundation\ComposerScripts::postAutoloadDump
> @php artisan package:discover --ansi

In Filesystem.php line 207:

  chmod(): Operation not permitted


Script @php artisan package:discover --ansi handling the post-autoload-dump event returned with error code 1
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$

3、通过 sail up -d 重新启动 Sail。如图3

图3

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$ sail up
[+] Running 6/6
 ⠿ Container weibo_meilisearch_1   Running                                                                         0.0s
 ⠿ Container weibo_redis_1         Running                                                                         0.0s
 ⠿ Container weibo_mailhog_1       Running                                                                         0.0s
 ⠿ Container weibo_selenium_1      Running                                                                         0.0s
 ⠿ Container weibo_mysql_1         Running                                                                         0.0s
 ⠿ Container weibo_laravel.test_1  Recreated                                                                      10.8s
Attaching to laravel.test_1, mailhog_1, meilisearch_1, mysql_1, redis_1, selenium_1
laravel.test_1  | 2021-12-27 01:47:52,236 INFO Set uid to user 0 succeeded
laravel.test_1  | 2021-12-27 01:47:52,240 INFO supervisord started with pid 17
laravel.test_1  | 2021-12-27 01:47:53,246 INFO spawned: 'php' with pid 18
laravel.test_1  | 2021-12-27 01:47:54,250 INFO success: php entered RUNNING state, process has stayed up for > than 1 seconds (startsecs)
laravel.test_1  | Starting Laravel development server: http://0.0.0.0:80
laravel.test_1  | [Mon Dec 27 01:47:57 2021] PHP 8.1.0 Development Server (http://0.0.0.0:80) started
meilisearch_1   | [2021-12-27T01:48:07Z INFO  actix_web::middleware::logger] 127.0.0.1:34400 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000048
mailhog_1       | [APIv1] KEEPALIVE /api/v1/events
meilisearch_1   | [2021-12-27T01:48:37Z INFO  actix_web::middleware::logger] 127.0.0.1:34404 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000344
meilisearch_1   | [2021-12-27T01:49:08Z INFO  actix_web::middleware::logger] 127.0.0.1:34408 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000050
mailhog_1       | [APIv1] KEEPALIVE /api/v1/events
meilisearch_1   | [2021-12-27T01:49:38Z INFO  actix_web::middleware::logger] 127.0.0.1:34412 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000054
meilisearch_1   | [2021-12-27T01:50:08Z INFO  actix_web::middleware::logger] 127.0.0.1:34418 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000053
mailhog_1       | [APIv1] KEEPALIVE /api/v1/events
meilisearch_1   | [2021-12-27T01:50:38Z INFO  actix_web::middleware::logger] 127.0.0.1:34422 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000048
meilisearch_1   | [2021-12-27T01:51:08Z INFO  actix_web::middleware::logger] 127.0.0.1:34424 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000050
mailhog_1       | [APIv1] KEEPALIVE /api/v1/events
meilisearch_1   | [2021-12-27T01:51:39Z INFO  actix_web::middleware::logger] 127.0.0.1:34428 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000063
meilisearch_1   | [2021-12-27T01:52:09Z INFO  actix_web::middleware::logger] 127.0.0.1:34434 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000052
mailhog_1       | [APIv1] KEEPALIVE /api/v1/events
meilisearch_1   | [2021-12-27T01:52:39Z INFO  actix_web::middleware::logger] 127.0.0.1:34438 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000119
meilisearch_1   | [2021-12-27T01:53:09Z INFO  actix_web::middleware::logger] 127.0.0.1:34442 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000048
mailhog_1       | [APIv1] KEEPALIVE /api/v1/events
meilisearch_1   | [2021-12-27T01:53:39Z INFO  actix_web::middleware::logger] 127.0.0.1:34446 "GET /health HTTP/1.1" 200 22 "-" "Wget" 0.000054
^CGracefully stopping... (press Ctrl+C again to force)
[+] Running 6/6
 ⠿ Container weibo_laravel.test_1  Stopped                                                                        10.7s
 ⠿ Container weibo_mailhog_1       Stopped                                                                         0.8s
 ⠿ Container weibo_redis_1         Stopped                                                                         0.8s
 ⠿ Container weibo_selenium_1      Stopped                                                                         4.7s
 ⠿ Container weibo_mysql_1         Stopped                                                                         1.4s
 ⠿ Container weibo_meilisearch_1   Stopped                                                                         0.7s
canceled
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$ sail up -d
[+] Running 6/6
 ⠿ Container weibo_mysql_1         Started                                                                         4.3s
 ⠿ Container weibo_selenium_1      Started                                                                         3.3s
 ⠿ Container weibo_meilisearch_1   Started                                                                         3.8s
 ⠿ Container weibo_redis_1         Started                                                                         2.9s
 ⠿ Container weibo_laravel.test_1  Started                                                                         6.5s
 ⠿ Container weibo_mailhog_1       Started                                                                         3.6s
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$

4、再次执行命令:sail artisan migrate 时,不再报错。如图4

图4

wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$ sail artisan migrate
Migrating: 2021_12_27_013012_create_statuses_table
Migrated:  2021_12_27_013012_create_statuses_table (199.83ms)
wangqiang@DESKTOP-QLPK8QM:/mnt/e/wwwroot/weibo$
永夜