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.

"fs" dependency was not found?

See original GitHub issue

I’m trying to 1.0.0-alpha.10 in Gatsby but I keep getting this error

* fs in ./node_modules/reduce-css-calc/dist/parser.js
To install it, you can run: npm install --save fs
× 「wdm」:
ERROR in ./node_modules/reduce-css-calc/dist/parser.js
Module not found: Error: Can't resolve 'fs' in 'C:\Users\risto\Sites\Personal\can-i-kick-it\node_modules\reduce-css-calc\dist'
 @ ./node_modules/reduce-css-calc/dist/parser.js 731:17-30
 @ ./node_modules/reduce-css-calc/dist/index.js
 @ ./node_modules/tailwind.macro/node_modules/tailwindcss/lib/util/negateValue.js
 @ ./node_modules/tailwind.macro/node_modules/tailwindcss/lib/util/resolveConfig.js
 @ ./node_modules/tailwind.macro/utils.umd.js
 @ ./src/pages/index.js
 @ ./.cache/sync-requires.js
 @ ./.cache/app.js
 @ multi ./node_modules/event-source-polyfill/src/eventsource.js (webpack)-hot-middleware/client.js?path=/__webpack_hmr&reload=true&overlay=false C://Users//risto//Sites//Personal//can-i-kick-it//.cache//app
i 「wdm」: Failed to compile.

My code is

import styled from "styled-components"
import tw from "tailwind.macro"

const Button = styled.button`


module.exports = {
  tailwind: {
    styled: "styled-components/macro",

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:3
  • Comments:10

github_iconTop GitHub Comments

khalwatcommented, Oct 10, 2019

This appears to be due to Tailwind CSS’s use of reduce-css-calc starting with Tailwind ^1.1.0, which apparently depends on it being run via Node.

@zlokomatic 's solution above works, which to clarify means adding this to your gatsby-node.js:

exports.onCreateWebpackConfig = ({actions, getConfig}) => {
    // Hack due to Tailwind ^1.1.0 using `reduce-css-calc` which assumes node
    const config = getConfig();
    config.node = {
        fs: 'empty'

The only other thing that could help is if tailwindcss was a peer dependency of babel-plugin-tailwind-components so that we could control the version that ends up getting used.

zlokomaticcommented, Aug 29, 2019

I added

config.node = {
        fs: 'empty'

to my webpack config to resolve the error

Read more comments on GitHub >

github_iconTop Results From Across the Web

fs dependency not found · Issue #11 - GitHub
When I run npm run dev I'm getting the following error: This dependency was not found: fs in ./node_modules/@nuxtjs/dotenv/dist/index.js. To ...
Read more >
getting the following error This dependency was not found: FS
When I run npm run dev. I am getting the following error. ERROR Failed to compile with 3 errors 22:07:39. This dependency was...
Read more >
node.js - How to resolve the "Module not found: Error: Can't ...
I've come across several packages I've tried to install via npm and have run into the Module not found: Error: Can't resolve 'fs'...
Read more >
module not found: error: can't resolve 'fs' -
Module not found: Error: Can't resolve 'fs' is a common error that can occur when working with certain libraries or frameworks. It indicates...
Read more >
Module not found: Can't resolve 'fs' error [Solved] | bobbyhadz
To solve the error, set the browser.fs property to false in your package.json file. module not found error cant resolve fs. The first...
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 Post

No results found

github_iconTop Related Hashnode Post

No results found