dotenv-webpack: Broken version 1.4.3
C:\Users\HP\CodeHell\test>gulp
module.js:471
throw err;
^
Error: Cannot find module './src'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.<anonymous> (C:\Users\HP\CodeHell\test\node_modules\dotenv-webpack\index.js:9:14)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
Version 1.4.3 installed using npm i dotenv-webpack --save
gave the above error. Tried 1.4.2 and didnt have any issue with that.
About this issue
- Original URL
- State: closed
- Created 7 years ago
- Comments: 28 (14 by maintainers)
For anyone else seeing this, note that the real error is not being logged. In my case I was missing webpack (listed as a peer dependency). This causes an error to occur in
dist/index.js
when attempting to require webpack. This package will then behave as if it’s in development mode and look for babel-register (which then in turn can error out and display the message we see above).I first started getting this after upgrading some libraries in
package.json
, which must have removedwebpack
as a dependency. I fixed this by explicitly requiringwebpack
in mypackage.json
.Thanks for sharing @dandrei, yeah it is required as a peerDependency so very possible to mess things up if it’s not explicitly included.
Thanks @marekfeikus , i’d love to get to the bottom of this but really struggling to grasp what exactly is going on.