无法为 nativephp 应用程序提供服务

Unable to serve nativephp application

提问人:huhu 提问时间:8/1/2023 最后编辑:matiaslauritihuhu 更新时间:8/6/2023 访问量:232

问:

我正在使用 Laravel 10.16.1 和 MacOS。我一直在尝试第一次使用我的 nativePHP 应用程序,但我收到以下错误:php artisan native:serve

Starting NativePHP dev server…
Fetching latest dependencies…
Starting NativePHP app…

   ErrorException 

  file_get_contents(/home/user/processApp-native/vendor/nativephp/electron/src/Commands/../../resources/js/node_modules/electron/dist/Electron.app/Contents/Info.plist): Failed to open stream: No such file or directory

  at vendor/nativephp/electron/src/Commands/DevelopCommand.php:65
     61▕      * @return void
     62▕      */
     63▕     protected function patchPlist()
     64▕     {
  ➜  65▕         $pList = file_get_contents(__DIR__.'/../../resources/js/node_modules/electron/dist/Electron.app/Contents/Info.plist');
     66▕ 
     67▕         // Change the CFBundleName to the correct app name
     68▕         $pattern = '/(<key>CFBundleName<\/key>\s+<string>)(.*?)(<\/string>)/m';
     69▕         $pList = preg_replace($pattern, '$1'.config('app.name').'$3', $pList);

      +14 vendor frames 

  15  artisan:37
      Illuminate\Foundation\Console\Kernel::handle(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))'
php laravel native-php

评论

0赞 user3783243 8/1/2023
你能把问题格式化吗?很难按原样阅读。谢谢。此外,添加目录结构可能会帮助解决这个问题。
0赞 matiaslauriti 8/1/2023
你先运行native:install了吗?
0赞 huhu 8/3/2023
我运行了“php artisan native:install”,它成功安装了 npm 包

答:

0赞 huhu 8/3/2023 #1

原来我需要在命令运行之前使用sudo

$ sudo php artisan native:serve

评论

0赞 A.L 8/6/2023
你知道为什么需要超级用户访问权限吗?使用此命令,可能会改变您的系统。artisanartisan