-
-
Notifications
You must be signed in to change notification settings - Fork 601
Description
after an, apparently successful, php please setup-cp-vite , running npm run cp:dev triggers a Cannot find package '@statamic/cms' error.
The error comes from the fact that my php app runs inside a docker container where node is not installed. Indeed, I run all node commands directly from my computer (ie : not in a container). So the @statamic/cms node dep were not installed ...
2 things here :
1- maybe add a check to verify if node is reachable in the "installDependencies" of the vendor/statamic/cms/src/Console/Commands/SetupCpVite.php file, if not reacheable, just mention that we need to run npm install manually.
2- this could also be mentioned in the doc right here : https://v6.statamic.dev/control-panel/css-javascript#setting-up-vite
full trace :
php please setup-cp-vite
INFO Installed dependencies.
INFO Added cp:dev and cp:build scripts to package.json.
INFO Published vite-cp.config.js.
INFO Published stubs for Control Panel CSS & JavaScript.
INFO Publishing [statamic-cp-dev] assets.
Copying directory [vendor/statamic/cms/resources/dist-dev] to [public/vendor/statamic/cp-dev] ............................................... DONE
INFO Added Statamic::vite() snippet to AppServiceProvider.
npm run cp:dev
> cp:dev
> vite build --config vite-cp.config.js --watch
failed to load config from /xxxx/vite-cp.config.js
error during build:
Error [ERR_MODULE_NOT_FOUND]: Cannot find package '@statamic/cms' imported from /xxxx/.vite-temp/vite-cp.config.js.timestamp-1769580624506-cc79e264ed1368.mjs