question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

dotenv-webpack missing

See original GitHub issue

I upgraded to the latest @storybook/core and @storybook/react and now get:

info @storybook/react v5.2.0-beta.19
info 
info => Loading static files from: /Users/cyber/dev/jb/qc/qc-frontend/public .
info => Loading presets
WARN   Failed to load preset: "/Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/manager/manager-preset.js"
ERR! Error: Cannot find module 'dotenv-webpack'
ERR! Require stack:
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/manager/manager-webpack.config.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/manager/manager-preset.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/presets.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/config.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/build-static.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/server.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/dist/server/index.js
ERR! - /Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/bin/index.js
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:625:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:527:27)
ERR!     at Module.require (internal/modules/cjs/loader.js:683:19)
ERR!     at require (internal/modules/cjs/helpers.js:16:16)
ERR!     at Object.<anonymous> (/Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/manager/manager-webpack.config.js:14:45)
ERR!     at Module._compile (internal/modules/cjs/loader.js:776:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:643:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:556:12)
ERR!     at Module.require (internal/modules/cjs/loader.js:683:19)
ERR!     at require (internal/modules/cjs/helpers.js:16:16)
ERR!     at Object.<anonymous> (/Users/cyber/dev/jb/qc/qc-frontend/node_modules/@storybook/react/node_modules/@storybook/core/dist/server/manager/manager-preset.js:21:46)
ERR!     at Module._compile (internal/modules/cjs/loader.js:776:30)
ERR!     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
ERR!     at Module.load (internal/modules/cjs/loader.js:643:32)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:556:12)
ERR!  Error: Cannot find module 'dotenv-webpack'

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:19 (5 by maintainers)

github_iconTop GitHub Comments

1reaction
ndelangencommented, Apr 22, 2021

@futbolsalas15 if you can provide a clean reproduction repo, I can take a look.

I suspect it’s a lockfile issue, try removing all lockfiles, node_modules and re-installing. See if it works then.

0reactions
futbolsalas15commented, Apr 21, 2021

Hi!

It seems the error persists even with version 6.0.22

$ C:\project\node_modules\.bin\start-storybook --loglevel info
info @storybook/angular v6.0.22
info
info => Loading presets
WARN   Failed to load preset: "C:\\project\\node_modules\\@storybook\\angular\\node_modules\\@storybook\\core\\dist\\server\\manager\\manager-preset.js"
ERR! Error: Cannot find module 'dotenv-webpack'
ERR!     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
ERR!     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
ERR!     at Module.require (internal/modules/cjs/loader.js:692:17)
ERR!     at require (internal/modules/cjs/helpers.js:25:18)
ERR!     at Object.<anonymous> (C:\project\node_modules\@storybook\angular\node_modules\@storybook\core\dist\server\manager\manager-webpack.config.js:20:45)

I’ve tried to install the required package, but it seems to continue requiring more packages.

Analyzing the content of @storybook/core folder inside node_modules, it seems that it has its own version of node_modules, where the package is available. Maybe it is an error where the local node_modules inside @storybook/core isn’t being included in the build process?

Read more comments on GitHub >

github_iconTop Results From Across the Web

Fails if variable is not defined or .env file is missing · Issue #229
The Dotenv constructor returns something like the following object. This works great when using these defined variables such as process.env.
Read more >
Unable to access process.env variables with dotenv-webpack
I'm trying to access my .env file variables using dotenv-webpack so that they can be bundled later and I can use them on...
Read more >
dotenv-webpack - npm
A simple webpack plugin to support dotenv.. Latest version: 8.0.1, last published: 4 months ago. Start using dotenv-webpack in your project ...
Read more >
Using environment variables with Webpack - Prateek Surana
A guide for setting up and using environment variables with Webpack and handling different values for Production and Development ...
Read more >
Cannot find module 'dotenv' error in Node.js | bobbyhadz
To solve the error "Cannot find module 'dotenv'", make sure to install the dotenv package by opening your terminal in your project's root...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found