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

Unable to install Canvas UI #1438

Open
1 task done
nsaliu opened this issue Oct 24, 2024 · 3 comments
Open
1 task done

Unable to install Canvas UI #1438

nsaliu opened this issue Oct 24, 2024 · 3 comments
Labels
bug Something isn't working

Comments

@nsaliu
Copy link

nsaliu commented Oct 24, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Current Behavior

Admin
I cleaned and new Laravel 11 installation.
I executed these commands:

  • composer require austintoddj/canvas
  • php artisan canvas:install
  • php artisan storage:link

And everything is fine - I can access the admin section and create posts.

UI
I executed these commands:

  • php artisan canvas:ui
  • npm install

when executing npm run canvas.ui.dev I'm receiving this error:

www-data@59b7af186f0b:~/html$ npm run canvas.ui.dev

> canvas.ui.dev
> mix

[webpack-cli] Error [ERR_REQUIRE_ESM]: require() of ES Module /var/www/html/webpack.mix.js from /var/www/html/node_modules/laravel-mix/setup/webpack.config.js not supported.
webpack.mix.js is treated as an ES module file as it is a .js file whose nearest parent package.json contains "type": "module" which declares all .js files in that package scope as ES modules.
Instead either rename webpack.mix.js to end in .cjs, change the requiring code to use dynamic import() which is available in all CommonJS modules, or change "type": "module" to "type": "commonjs" in /var/www/html/package.json to treat all .js files as CommonJS (using .mjs for all ES modules instead).

    at module.exports (/var/www/html/node_modules/laravel-mix/setup/webpack.config.js:11:5)
    at loadConfigByPath (/var/www/html/node_modules/webpack-cli/lib/webpack-cli.js:1439:37)
    at async Promise.all (index 0)
    at async WebpackCLI.loadConfig (/var/www/html/node_modules/webpack-cli/lib/webpack-cli.js:1454:35)
    at async WebpackCLI.createCompiler (/var/www/html/node_modules/webpack-cli/lib/webpack-cli.js:1785:22)
    at async WebpackCLI.runWebpack (/var/www/html/node_modules/webpack-cli/lib/webpack-cli.js:1890:20)
    at async Command.<anonymous> (/var/www/html/node_modules/webpack-cli/lib/webpack-cli.js:912:21)
    at async Promise.all (index 1)
    at async Command.<anonymous> (/var/www/html/node_modules/webpack-cli/lib/webpack-cli.js:1372:13) {
  code: 'ERR_REQUIRE_ESM'
}

Do you have any suggestions?
Thanks!

Expected Behavior

No response

Steps To Reproduce

No response

Environment

- php version: 8.3.8
- npm: 10.9.0
- node: v18.20.4
- vite: vite/5.4.10 linux-arm64 node-v18.20.4

Anything else?

No response

@nsaliu nsaliu added the bug Something isn't working label Oct 24, 2024
@ravenshill
Copy link

I am having the same issue, same sequence of commands

@nsaliu
Copy link
Author

nsaliu commented Nov 19, 2024

Any news here?

@pocketnest-erik
Copy link

pocketnest-erik commented Nov 19, 2024

Same issue.

What fixed it for me was changing the command in my package.json file. The base canvas installation assumes that laravel mix is still the default, when laravel has moved to Vite since 10.x.

just change mix to vite and give it a shot. Theres definitely more places where mix is expected that you have to fix to get it running

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

No branches or pull requests

3 participants