Closed LexanRed closed 2 years ago
It's working here on a fresh install. Is suspect you're on an onder version of Laravel or Statamic without Vite support. However when you've fixed that I'd advice you to run npm i && npm run dev
as a local dev environment. That way you also get auto reloading but also auto rebuilding of your your css/js + you'd be running under your actual domain.
I have exactly the same on a fresh Laragon environment with a fresh Peak download.
After opening in the browser:
Illuminate\Contracts\Container\BindingResolutionException
Target class [Illuminate\Foundation\Vite] does not exist.
And while compiling assets:
failed to load config from C:\laragon\www\my-site\vite.config.js
error when starting dev server:
Error: Cannot find module 'node:path'
Require stack:
- C:\laragon\www\my-site\node_modules\vite\dist\node-cjs\publicUtils.cjs
- C:\laragon\www\my-site\node_modules\vite\index.cjs
- C:\laragon\www\my-site\node_modules\laravel-vite-plugin\dist\index.js
- C:\laragon\www\my-site\vite.config.js
- C:\laragon\www\my-site\node_modules\vite\dist\node\chunks\dep-4da11a5e.js
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:880:15)
at Function.Module._load (internal/modules/cjs/loader.js:725:27)
at Module.require (internal/modules/cjs/loader.js:952:19)
at require (internal/modules/cjs/helpers.js:88:18)
at Object.<anonymous> (C:\laragon\www\my-site\node_modules\vite\dist\node-cjs\publicUtils.cjs:5:14)
at Module._compile (internal/modules/cjs/loader.js:1063:30)
at Module._extensions..js (internal/modules/cjs/loader.js:1092:10)
at Object._require.extensions.<computed> [as .js] (file:///C:/laragon/www/my-site/node_modules/vite/dist/node/chunks/dep-4da11a5e.js:63540:17)
at Module.load (internal/modules/cjs/loader.js:928:32)
at Function.Module._load (internal/modules/cjs/loader.js:769:14)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `vite`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\klaas\AppData\Roaming\npm-cache\_logs\2022-10-24T06_09_28_474Z-debug.log
I'm not familiar with Laragon unfortunately. But which version of Laravel are you running @Sennik? Could you post the output of php please support:details
?
Dag Rob, thanks for the fast response.
I use the recommended method:
The easiest way to install Statamic together with Peak is to use the official CLI. Install the CLI by running composer global require statamic/cli and for each project just run statamic new my-site studio1902/statamic-peak
After this composer.json says:
laravel/framework": "^8.82
Result please support:details:
Statamic 3.3.48 Pro Laravel 8.83.25 PHP 7.4.19 No addons installed
Hey Klaas :-)
Ah yeah, you're running Laravel 8. Vite got introduced somewhere in Laravel 9 so the error you're seeing is Laravel missing the Vite tooling.
I'm not sure why in your case Laravel 8 gets installed. When I run the same command I get the latest version of Laravel.
"laravel/framework": "^9.0",
Perhaps this has something to do with Laragon. Is your CLI update to date? You can update it using composer global update statamic/cli
.
Ok, updated that too (should be fresh in a new Laragon install)...
Now with 'php please support:details':
Environment
Application Name: Statamic
Laravel Version: 9.36.4
PHP Version: 8.1.10
Composer Version: 2.4.1
Environment: local
Debug Mode: ENABLED
URL: my-app.test
Maintenance Mode: OFF
Cache
Config: NOT CACHED
Events: NOT CACHED
Routes: NOT CACHED
Views: NOT CACHED
Drivers
Broadcasting: log
Cache: statamic
Database: mysql
Logs: stack / single
Mail: smtp
Queue: sync
Session: file
Statamic
Addons: 0
Antlers: runtime
Version: 3.3.48 PRO
But still the same vite error...
failed to load config from C:\laragon\www\my-app\vite.config.js
error when starting dev server:
Error: Cannot find module 'node:path'
...
What happens when you run npm install && npm run dev
in the root of your project. Does that work?
This all has not much to do with Peak I'm afraid.
npm install && npm run dev
The above error.
Sorry I'm out of ideas and don't have a Windows machine to test this out on. You might wanna see if you can get some better help in the Statamic Discord.
Hang on. Is node/npm up to date?
Now it is ;-)
Laragon carries Node 14 and 18. I changed it from 14 to 18 and it seems to work :-)
Thanks so far!
Nice! Yeah I think you need Node 15+ for Vite.
Thanks Rob!
Describe the bug When installing a fresh Statamic instance via
statamic new my-site studio1902/statamic-peak
then this error appears.Illuminate\Contracts\Container\BindingResolutionException Target class [Illuminate\Foundation\Vite] does not exist.
To Reproduce Steps to reproduce the behavior:
statamic new my-site studio1902/statamic-peak
php artisan serve
Expected behavior Peak demo page should appear.
Screenshots
Desktop (please complete the following information):