html-to-image: Error: ENOENT: no such file or directory for /node_modules/html-to-image/src/applyStyleWithOptions.ts'

Expected Behavior

When i install the html-to-image package via npm, it should come with the src folder, which it doesnt, unless i’m doing something wrong

The html-to-image package should come with the src folder when insalled via npm

Current Behavior

Error: ENOENT: no such file or directory in /node_modules/html-to-image/src/applyStyleWithOptions.ts’

The src folder is not found, hence the ENOENT error

Possible Solution

Update the npm package to include the src folder instead of me having to manually transfer it to the node_modules folder for the package to work

Steps To Reproduce

  1. Install html-to-image npm package in React js project
  2. Use the package in your project to snapshot a HTML element via the cliient-side (in any way whatsoever)
  3. Run the project
Error Message & Stack Trace

<!-- Provide a log message if relevant -->

       WARNING in ../node_modules/html-to-image/es/cloneNode.js

       Module Warning (from ../node_modules/source-map-loader/dist/cjs.js):

       Failed to parse source map from '/tmp/build_5d01cf99/node_modules/html-to-image/src/cloneNode.ts' file: Error: ENOENT: no  such file or directory, open '/tmp/build_5d01cf99/node_modules/html-to-image/src/cloneNode.ts'

Additional Context

Your Environment

Ran the package in React js client side while trying to convert HTML element toPng Also ran the project in Heroku environment through connection via Github, the problem reoccurs in the same manner in both environments

  • html-to-image: [1.9.0]
  • OS: [e.g. Windows 10]
  • Browser: [e.g. Mozilla 97.0.2]

About this issue

  • Original URL
  • State: open
  • Created 2 years ago
  • Reactions: 8
  • Comments: 22 (6 by maintainers)

Most upvoted comments

Replace line from package.json inside scripts,

"start": "GENERATE_SOURCEMAP=false react-scripts start"

or

Paste line inside .env file,

GENERATE_SOURCEMAP=false

It works for me. Thanks.

^ experiencing this issue as well, it seems as if #316 would fix it, hoping that can be merged.

Is it possible to merge #316 ?

We can temporarily disable source map generation for html-to-image, see https://github.com/bubkoo/html-to-image/issues/142#issuecomment-1120583566