Skip to content

[6.x] php please setup-cp-vite silently fails to install node deps #13697

@dadaxr

Description

@dadaxr

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        

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions