Skip to content
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

Getting an error with the chokidar package when using php artisan temporal:work --watch #26

Closed
esnare opened this issue Nov 17, 2023 · 2 comments

Comments

@esnare
Copy link

esnare commented Nov 17, 2023

This is the full error:

Comand:
sail artisan temporal:work --watch

Watcher process has terminated. Please ensure Node and chokidar are installed.
file:///var/www/html/vendor/keepsuit/laravel-temporal/bin/file-watcher.js:1
const chokidar = require('chokidar');
ReferenceError: require is not defined in ES module scope, you can use import instead
This file is being treated as an ES module because it has a '.js' file extension and '/var/www/html/package.json' contains "type": "module". To treat it as a CommonJS script, rename it to use the '.cjs' file extension.
    at file:///var/www/html/vendor/keepsuit/laravel-temporal/bin/file-watcher.js:1:18
    at ModuleJob.run (node:internal/modules/esm/module_job:194:25)

The solution in file-watcher.js file change: this: const chokidar = require('chokidar'); for this: import chokidar from "chokidar";

@cappuc
Copy link
Contributor

cappuc commented Nov 17, 2023

Can you retry with the latest version (0.6.11)?
I've changed the extension to cjs and it should work now

@esnare
Copy link
Author

esnare commented Nov 18, 2023

It worked like a charm.
Thanks!

@esnare esnare closed this as completed Nov 18, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants