Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't resolve 'Fabric/fabric.require' in node_modules. #82

Closed
Fridthjof opened this issue Oct 26, 2018 · 15 comments
Closed

Can't resolve 'Fabric/fabric.require' in node_modules. #82

Fridthjof opened this issue Oct 26, 2018 · 15 comments
Labels
Enhancement Enhance performance or improve usability of original features.

Comments

@Fridthjof
Copy link

Fridthjof commented Oct 26, 2018

Module not found: Error: Can't resolve 'fabric/dist/fabric.require' in '.\node_modules\tui-image-editor\dist'

I've already looked at former issues with fabric, these are not fixing the problem.

Version

"tui-image-editor": "^3.2.2"
Angular 6.1.0
Node 8.11
Tried with fabric 1.6.7 and 2.4.2

// Write example code
instance = new ImageEditor(document.querySelector('#tui-image-editor'),
        { cssMaxWidth: 700, cssMaxHeight: 500, selectionStyle: { cornerSize: 20, rotatingPointOffset: 70 }
        });
@Fridthjof
Copy link
Author

Apperently i fixed the former issue.

Now it's given me the:

ERROR in ./node_modules/fabric/dist/fabric.require.js
Module not found: Error: Can't resolve 'http' in '.\node_modules\fabric\dist'
ERROR in ./node_modules/fabric/dist/fabric.require.js
Module not found: Error: Can't resolve 'https' in '.\node_modules\fabric\dist'

Anyone know if it's the HttpModule -> HttpClientModule thingy that Angular was going through version 5 to 6?

@Fridthjof
Copy link
Author

Fridthjof commented Oct 29, 2018

"Fixed" the problem by replacing
HTTP = require("http"), HTTPS = require("https")
into
HTTP = require("@angular/http"), HTTPS = require("@angular/http") in the fabric.require.js file.

@szepeviktor
Copy link

"postinstall": "npm install --no-save --no-optional fabric@~1.6.7"

this seems to be a work-around

@jinwoo-kim-nhn jinwoo-kim-nhn added the Enhancement Enhance performance or improve usability of original features. label Dec 27, 2018
@hzeeli
Copy link

hzeeli commented Jan 19, 2019

“postinstall”:“npm install --no-save --no-optional fabric@~1.6.7”

这似乎是一种解决方法

how to resolve it?

@GEMI
Copy link

GEMI commented Mar 3, 2019

This issue is very annoying. How can I solve this using yarn?

@hestellez
Copy link

@Fridthjof 's solution worked for me, I also modified the fabric.js file.

@guilhermenunes09
Copy link

@hestellez what did you change in fabric.js?

@guilhermenunes09
Copy link

The solution here and in documentation didn't work for me, unfortunately.

@hestellez
Copy link

"Fixed" the problem by replacing
HTTP = require("http"), HTTPS = require("https")
into
HTTP = require("@angular/http"), HTTPS = require("@angular/http") in the fabric.require.js file.

Inside node modules, I don't know If there are problems when deploying, but it let me work for the moment

@naveenkumarmark
Copy link

I got the same issue when I tried to install it, and this command solved the issue!
npm install --save --no-optional fabric@^3.3.2

@electrocnic
Copy link

There is no fabric.require.js in fabric/dist/, there is only fabric.js but tui-image editor is still looking for fabric.require

Could somebody finally please fix this? The suggested workarounds did not help in my case.

@AlvaroBrey
Copy link

AlvaroBrey commented Jan 17, 2020

This is because the postinstall command in package.json in the currently published version installs fabric version ^3.3.2, in which there is no fabric/dist/fabric.require file.

Fortunately, this seems to have been patched in master (there is no postinstall or references to fabric/dist/fabric.require), but there is no release that contains these changes for now.
@jinwoo-kim-nhn @junghwan-park : we really need a release for this, it's very very annoying. Said release would also solve incompatibilities with Yarn as per #286

@AlvaroBrey
Copy link

AlvaroBrey commented Jan 17, 2020

Here's a workaround: add the following to your package.json scripts section if using yarn:

    "postinstall": "yarn add --peer [email protected] --ignore-optional --ignore-scripts"

Or the following if using npm:

    "postinstall": "npm install --no-optional --igore-scripts [email protected]"

(The --ignore-scripts flag is needed so that postinstall does not call itself in a loop)

This is not really an ideal solution as the wrong version of fabric is still being installed by the tui.image-editor postinstall script, we are just then re-installing the correct version over it.

@jinwoo-kim-nhn
Copy link
Contributor

jinwoo-kim-nhn commented Jan 17, 2020

We'll release the fix for #286, next week

@jinwoo-kim-nhn
Copy link
Contributor

It was released in v3.7.3.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Enhancement Enhance performance or improve usability of original features.
Projects
None yet
Development

No branches or pull requests

10 participants