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.

Node env Error: Can't resolve 'fs'

See original GitHub issue

This is my full code :

import juice from 'juice'
	import htmlDocx from 'html-docx-js'
	import { saveAs } from 'file-saver'

	export default {
		methods: {
			handleExport () {
				var content = htmlDocx.asBlob('hello')
				saveAs(content, 'test.docx')
			}
		}
	}

Run webpack compiler,Cmd show a error :

Module not found: Error: Can't resolve 'fs' in 'F:\gittest\js-office-demo\node_modules\html-docx-js\build

Waiting online … @anowak @kozborn @gpurgal

Issue Analytics

  • State:open
  • Created 7 years ago
  • Reactions:2
  • Comments:10 (2 by maintainers)

github_iconTop GitHub Comments

11reactions
N1ktocommented, Apr 25, 2017

@abhisheknalin try consume bundled version from /dist folder. E.g.:

import htmlDocx from 'html-docx-js/dist/html-docx';

const converted = htmlDocx.asBlob(content);
saveAs(converted, 'test.docx');
3reactions
abhisheknalincommented, Apr 25, 2017

Thanks a lot for your time.

import htmlDocx from 'html-docx-js/dist/html-docx';

this import works

Read more comments on GitHub >

github_iconTop Results From Across the Web

Error: Can't resolve 'fs' in node_modules\dotenv\lib' - Stack ...
env file, I imported dotenv and I exported the module where there is all my environment and these variables as if below. export...
Read more >
Module not found: Error: Can't resolve 'fs' · Issue #581 - GitHub
Module not found: Error: Can't resolve 'fs' #581 ... I have tried everything even experienced coders don't know. process.env is not working!
Read more >
module not found error can't resolve 'fs' in dotenv react
The reason you are running into this error is because dotenv is meant to be used in Node.js, not in the browser. If...
Read more >
can't resolve 'fs' in dotenv - Autoinfo
node = { fs: 'empty' } to my next.config.js file. Can you verify that you replaced all 'react-native-dotenv' imports with the '@env' import?...
Read more >
Node.js – Can't resolve 'fs' in nextjs with custom express server
I found that to resolve this issue, I should add config.node = { fs: 'empty' } to my next.config.js file. The problem is...
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