Skip to content

[Bug]: Php binary /vendor/nativephp/electron/resources/js/resources/php: 1: Syntax error: "(" unexpected #23

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
elsayed85 opened this issue Jul 21, 2023 · 14 comments
Labels
bug Something isn't working linux

Comments

@elsayed85
Copy link

What happened?

Error: Command failed: /home/sayed/Desktop/DesktopApps/ray/vendor/nativephp/electron/resources/js/resources/php artisan native:config
/home/sayed/Desktop/DesktopApps/ray/vendor/nativephp/electron/resources/js/resources/php: 1: Syntax error: "(" unexpected

at ChildProcess.exithandler (node:child_process:430:12)
at ChildProcess.emit (node:events:513:28)
at maybeClose (node:internal/child_process:1091:16)
at Socket.<anonymous> (node:internal/child_process:449:11)
at Socket.emit (node:events:513:28)
at Pipe.<anonymous> (node:net:322:12) {

code: 2,
killed: false,
signal: null,
cmd: '/home/sayed/Desktop/DesktopApps/ray/vendor/nativephp/electron/resources/js/resources/php artisan native:config',
stdout: '',
stderr: '/home/sayed/Desktop/DesktopApps/ray/vendor/nativephp/electron/resources/js/resources/php: 1: Syntax error: "(" unexpected\n'
}

API server started on port 4000

Starting PHP server... /home/sayed/Desktop/DesktopApps/ray/vendor/nativephp/electron/resources/js/resources/php artisan serve /home/sayed/Desktop/DesktopApps/ray

Making sure app folders are available

Migrating database...

/home/sayed/Desktop/DesktopApps/ray/vendor/nativephp/electron/resources/js/resources/php: 1: Syntax error: "(" unexpected

How to reproduce the bug

php artisan native:serve

Package Version

0.10

PHP Version

8.1

Laravel Version

10

Which operating systems does with happen with?

Linux

Notes

No response

@elsayed85 elsayed85 added the bug Something isn't working label Jul 21, 2023
@akashpoudelnp
Copy link

akashpoudelnp commented Jul 21, 2023

I am facing same issue
My system:
OS: Linux Mint 21
PHP Version: 8.2.8.
Node: 16.18.1

@antonioanerao
Copy link

antonioanerao commented Jul 21, 2023

I managed to use the project in Ubuntu

After you run php artisan native:install, say no when it ask you to run the server. Then, copy you php file from /usr/bin/php to nativephp/vendor/nativephp/php-bin/bin/mac/x86.

After that when you run php artisan native:run it will use your php library instead of the mac php library version

@akashpoudelnp
Copy link

@antonioanerao is there any workaround for windows

@antonioanerao
Copy link

@antonioanerao is there any workaround for windows

Sorry I didnt tried it

@akhilmohan07
Copy link

I managed to use the project in Ubuntu

After you run php artisan native:install, say no when it ask you to run the server. Then, copy you php file from /usr/bin/php to nativephp/vendor/nativephp/php-bin/bin/mac/x86.

After that when you run php artisan native:run it will use your php library instead of the mac php library version

its not working for me. i'm using linux, any other alternative solution

@gasner
Copy link

gasner commented Jul 29, 2023

copy your php file from /vendor/nativephp/php-bin/bin/linux/x64 to /vendor/nativephp/php-bin/bin/mac/x86.

@KrzysztofPlaczek
Copy link

copy your php file from /vendor/nativephp/php-bin/bin/linux/x64 to /vendor/nativephp/php-bin/bin/mac/x86.

this works on ubuntu

@shakeel-nodesol
Copy link

this is not working in zorin os
/vendor/nativephp/php-bin/bin/linux/x64 to /vendor/nativephp/php-bin/bin/mac/x86.
Starting NativePHP dev server…
Fetching latest dependencies…
Starting NativePHP app…

[email protected] dev
electron-vite dev --watch

vite v4.4.7 building for development...

watching for file changes...

build started...
✓ 4 modules transformed.
out/main/index.js 0.55 kB
built in 224ms.

build the electron main process successfully


vite v4.4.7 building for development...

watching for file changes...

build started...
"contextBridge" and "ipcRenderer" are imported from external module "electron" but never used in "src/preload/index.js".
✓ 1 modules transformed.
out/preload/index.js 0.70 kB
built in 41ms.

build the electron preload files successfully


dev server running for the electron renderer process at:

➜ Local: http://localhost:5173/
➜ Network: use --host to expose

start electron app...

node:events:492
throw er; // Unhandled 'error' event
^

Error: spawn /home/nodesol/vendor/nativephp/electron/resources/js/node_modules/electron/dist/electron ENOENT
at ChildProcess._handle.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21)
Emitted 'error' event on ChildProcess instance at:
at ChildProcess._handle.onexit (node:internal/child_process:289:12)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -2,
code: 'ENOENT',
syscall: 'spawn /home/nodesol/vendor/nativephp/electron/resources/js/node_modules/electron/dist/electron',
path: '/home/nodesol/vendor/nativephp/electron/resources/js/node_modules/electron/dist/electron',
spawnargs: [ '.' ]
}

Node.js v18.17.0

My system:
OS: Linux Zorin OS
PHP Version: 8.2.8

@simonhamp simonhamp added the linux label Aug 3, 2023
@mpociot
Copy link
Member

mpociot commented Aug 3, 2023

Closing this as we don't have official Linux support yet.

@mpociot mpociot closed this as completed Aug 3, 2023
@KrzysztofPlaczek
Copy link

Closing this as we don't have official Linux support yet.

how come?
image
https://nativephp.com/docs/1/getting-started/installation

@NPKIN1998
Copy link

Closing this as we don't have official Linux support yet.

looking forward to have it as i will simplify this up fast

@Bbcar225
Copy link

Bbcar225 commented Aug 7, 2023

copy your php file from /vendor/nativephp/php-bin/bin/linux/x64 to /vendor/nativephp/php-bin/bin/mac/x86.

this works on ubuntu

Work for me

@bardh78
Copy link

bardh78 commented Aug 8, 2023

/vendor/nativephp/php-bin/bin/linux/x64

Yep. Thanks.

@ZELMAT
Copy link

ZELMAT commented Feb 9, 2024

J'ai un bug sur windows :

Error: spawn php ENOENT
at Process.onexit (node:internal/child_process:283:19)
at onErrorNT (node:internal/child_process:476:16)
at process.processTicksAndRejections (node:internal/process/task_queues:82:21) {
errno: -4058,
code: 'ENOENT',
syscall: 'spawn php',
path: 'php',
spawnargs: [
'-dxdebug.start_with_request=yes',

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working linux
Projects
None yet
Development

No branches or pull requests