<p>This path is on your host machine but this isn't how docker <em>sees</em> things. To Nitro, the location of the folder is <code>/app/web/cpresources</code>.</p>
<p>Without going into too much details, I'd recommend going with <a href="https://craftcms.com/docs/3.x/config/#aliases" rel="nofollow noreferrer">an alias</a> instead of hard-setting your <code>webroot</code> the way you are currently doing it. Doing so will make your scaffolding just <em>work</em> without having to change this path every time.</p>
<p>In your <code>config/general.php</code> define your <code>webroot</code> alias like this:</p>
<pre class="lang-php prettyprint-override"><code>'aliases' =&gt; [
    'webroot' =&gt; dirname(__DIR__) . '/web'
],
</code></pre>
<p>You can then remove <code>'resourceBasePath' =&gt; App::env('WEB_ROOT_PATH').'cpresources',</code> altogether since <a href="https://craftcms.com/docs/3.x/config/config-settings.html#resourcebasepath" rel="nofollow noreferrer">its default value</a> is already correct.</p>
<p>This alias will also be handy for setting things like File System Path on your volumes.</p>

CC BY-SA 4.0
2021-03-09T15:01:53.587Z
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
CC BY-SA 4.0
2021-03-09T08:10:54.397Z
2021-03-09T08:10:54.397Z
Oli
<p>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:</p>
<pre><code>Invalid Configuration – yii\base\InvalidConfigException
/Users/cbad/websites/nitro/core/cms/web/cpresources doesn’t exist or isn’t writable by PHP.
</code></pre>
<p>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!</p>
<p>I was syncing my .env file and general.php when this began. In .env I made WEB_ROOT_PATH like this:</p>
<pre><code>WEB_ROOT_PATH=/Users/cbad/websites/nitro/core/cms/web/
</code></pre>
<p>In general.php I did this:</p>
<pre><code>'resourceBasePath' =&gt; App::env('WEB_ROOT_PATH').'cpresources',
</code></pre>
<p>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:</p>
<pre><code>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
</code></pre>
<p>It seems to resolve to the correct location, but I get the error listed above. Is it obvious what I'm doing wrong?</p>
<p>Thanks!</p>

<config><nitro>
Invalid Configuration Error in Craft CMS 3 using Nitro 2
# Invalid Configuration Error in Craft CMS 3 using Nitro 2

(Asked by: username_0 on 2021-03-09)

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/username_0/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:
WEB_ROOT_PATH=/Users/username_0/websites/nitro/core/cms/web/

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 username_0  staff    64 Mar  7 16:55 assets
drwxr-xr-x  2 username_0  staff    64 Mar  7 16:27 cpresources
-rw-rw-rw-@ 1 username_0  staff   604 Feb  5 20:12 index.php
-rw-rw-rw-@ 1 username_0  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?
Thanks!

**Tags:** config, nitro


---

## 1 answers

### Answer by username_1 on 2021-03-09. Score: 4 | Accepted answer

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.

> **Comments:**
> **username_0**: 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!  

---

