In trouble with dotEnv and Coldbox

I started using dotEnv in a Coldbox installation.
dotEnv correctly reads the values in my .env file and I can use ${var_name} in my server.json.

The problem is Coldbox: with dotEnv installed it raises an exception.
The following:

The Error Occurred in
[my_path]\test-coldbox\modules\coldbox\system\ioc\Builder.cfc: line 645**

643: } )
644: ),
**645: type = "Builder.DSLDependencyNotFoundException"**
646: );
647: }
The target 'EnvironmentFileService@commandbox-dotenv' requested a missing dependency with a Name of 'moduleSettings' and DSL of 'commandbox:moduleSettings:commandbox-dotenv'

Am I doing it wrong somewhere?

Here you can find a test pakacge:

It’s enough to unzip the file in a CommandBox directory and type:

start server

Then point the browser to:


to see the error.

I try with this version of Lucee:

… and with this release of Coldbox:

  • “coldbox”:“6.8.1”,
  • “coldbox”:“6.8.2+6”,
  • “coldbox”:“7.0.0+7”,

I hope this can help you.

Thank you!

Ok, i found the solution: i have to remove the entry of the installPath for dotEnv in box.json.

With this configuration:


Okay, this works.

Why? :grin:

CommandBox DotENV is a CommandBox module. It doesn’t run at all in ColdBox.

Yes, like Eric said, it appears you installed the module into your actual ColdBox app, when it’s a CommandBox module and intended to be installed into CommandBox CLI. dotenv is also bundled out-of-the-box with CommandBox 5.9 so you don’t even need to install it and you don’t need it in your box.json.

1 Like

I thought I tried stripping all the dotEnv out of my box.json and the system was broken.
I must have done something wrong…

@bdw429s and @elpete thank you very much for support :slight_smile: