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.

ERROR in ./node_modules/image-size/lib/index.js

See original GitHub issue

Plotly.js version: 1.58.4 Platform: mac bis sur

When upgrading plotly from 1.52.2 to 1.58.4 a new error appears when trying to run it in a react webpage:

ERROR in ./node_modules/image-size/lib/index.js
Module not found: Error: Can't resolve 'fs' in '/local/home/xxx/node_modules/image-size/lib'
 @ ./node_modules/image-size/lib/index.js 3:9-22
 @ ./node_modules/plotly.js/src/traces/image/helpers.js
 @ ./node_modules/plotly.js/src/traces/image/calc.js
 @ ./node_modules/plotly.js/src/traces/image/index.js
 @ ./node_modules/plotly.js/lib/image.js
 @ ./node_modules/plotly.js/lib/index.js
 @ ./src/util/ui/MultiChart.js
 @ ./src/xxx/xxx.js
 @ ./src/App.js
 @ ./src/index.development.js

Is there some new dependency which needs to be added?

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Comments:13 (9 by maintainers)

github_iconTop GitHub Comments

2reactions
bishonencommented, Jan 9, 2021

Wasn’t quite sure how you meant to change the encoding (in the header of the index.html ?). Therefore I searched, found and followed the advice from someone who already had this issue. They used the minified version which turned out to be working fine.

With this in place, I can gladly confirm that the latest build does not throw any ‘fs’ related errors anymore!

Compiled successfully.

Thanks to all for the quick turnaround. This is in part what makes plotly a great library (on which one can rely upon). Thanks

1reaction
archmojcommented, Jan 7, 2021

All of my initial guesses proved false. The dist version of image-size has require('fs'). I can’t find that Plotly runs the brfs transform when bundling, which would browserify fs calls:

https://github.com/plotly/plotly.js/blob/3a501ef02964c6eb7c5f5e790a0696fab3738da2/tasks/util/browserify_wrapper.js#L44

In short, it’s not clear to me.

@rreusser simply FYI we are using image-size@0.7.5 not image-size@@0.9.3 which liked above. Suggestions are welcome : )

Read more comments on GitHub >

github_iconTop Results From Across the Web

Module not found: Error: Can't resolve 'fs' in - Stack Overflow
I deleted all the packes(node_modules) and did a npm install. i Still get this three errros: ERROR in ./node_modules/resolve/lib/async. js ...
Read more >
cannot find module [Node npm Error Solved] - freeCodeCamp
To fix the error, you need to install the package that is absent in your project directory – npm install package-name or yarn...
Read more >
Node.js v19.3.0 Documentation
Indicates the failure of an assertion. All errors thrown by the node:assert module will be instances of the AssertionError class. new assert.AssertionError( ...
Read more >
Jimp - npm
An image processing library for Node written entirely in JavaScript, with zero native dependencies. The default jimp configuration. Supported ...
Read more >
Top 10 Most Common Node.js Developer Mistakes - Toptal
The distinction here between “module.exports” and “exports” is very important, and is often a cause of frustration among new Node.js developers. Mistake #6: ......
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