weihanchen / ng2-screenshot

Angular2+ directive for screen capture.
https://weihanchen.github.io/ng2-screenshot/#/
4 stars 2 forks source link

Error: Can't resolve 'dom-to-image' #2

Open charlenebuena opened 4 years ago

charlenebuena commented 4 years ago

Hello. I'm getting an error as soon as I import the module. Do we need to install dom-to-image? Thanks


Module not found: Error: Can't resolve 'dom-to-image' in 'projectname/node_modules/ng2-screenshot/fesm5'
 @ ./~/ng2-screenshot/fesm5/ng2-screenshot.js 4:0-38
 @ ./src/app/module_name/module_name.module.ts
 @ ./src/app/app.module.ts
 @ ./src/main.ts
 @ multi webpack-dev-server/client?http://localhost:4200 ./src/main.ts`
weihanchen commented 4 years ago

Right, please run npm install

garcia-0E commented 4 years ago

Hi, i'm getting this same error besides Module not found: Error: Can't resolve 'jquery' in 'C:\Users\Ramon Tomas\Documents\Workspace\paint-store\node_modules\ng2-screenshot\fesm2015' and npm install is not fixing the error. Any clue?

garcia-0E commented 4 years ago

Hi, i'm getting this same error besides Module not found: Error: Can't resolve 'jquery' in 'C:\Users\Ramon Tomas\Documents\Workspace\paint-store\node_modules\ng2-screenshot\fesm2015' and npm install is not fixing the error. Any clue?

I found out what was going on, jquery import on ng2-screenshot.js was using a wrong directory.

JAspeling commented 4 years ago

I had to install dom-to-image as a dependency. It's a pity that its a dependency as its been updated 3 years ago with a lot of open pull requests. I had to change to html2canvas to get around some issues I ran into with this package.

It would be very nice if we can use html2canvas instead of dom-to-image due to the current support + maintenance on that package?