I'm getting into Nitro 2 and so far loving it. I decided to create a scaffolding project to jump start other projects. Along the way, I ran into this error:

Invalid Configuration – yii\base\InvalidConfigException
/Users/cbad/websites/nitro/core/cms/web/cpresources doesn’t exist or isn’t writable by PHP.

The path exists and the permissions, look correct. They are drwxr-xr-x. I removed the contents of cpresrouces based on another solution found on google but didn't help. I'm missing something!

I was syncing my .env file and general.php when this began. In .env I made WEB_ROOT_PATH like this:


In general.php I did this:

'resourceBasePath' => App::env('WEB_ROOT_PATH').'cpresources',

If it helps, here are the permissions on the folders. They seem to be the same as those on a site that doesn't get this error:

drwxr-xr-x  2 cbad  staff    64 Mar  7 16:55 assets
drwxr-xr-x  2 cbad  staff    64 Mar  7 16:27 cpresources
-rw-rw-rw-@ 1 cbad  staff   604 Feb  5 20:12 index.php
-rw-rw-rw-@ 1 cbad  staff  1202 Feb  5 20:12 web.config

It seems to resolve to the correct location, but I get the error listed above. Is it obvious what I'm doing wrong?


1 Answer 1


This path is on your host machine but this isn't how docker sees things. To Nitro, the location of the folder is /app/web/cpresources.

Without going into too much details, I'd recommend going with an alias instead of hard-setting your webroot the way you are currently doing it. Doing so will make your scaffolding just work without having to change this path every time.

In your config/general.php define your webroot alias like this:

'aliases' => [
    'webroot' => dirname(__DIR__) . '/web'

You can then remove 'resourceBasePath' => App::env('WEB_ROOT_PATH').'cpresources', altogether since its default value is already correct.

This alias will also be handy for setting things like File System Path on your volumes.

  • Thanks for the explanation, makes total sense and I shouldn't have missed it. And the use of a an alias with dirname is just a superior solution for what I'm doing!
    – cbad
    Commented Mar 9, 2021 at 15:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.