Skip to content
This repository has been archived by the owner on Aug 17, 2024. It is now read-only.

module not found #64

Closed
kishor-dabi opened this issue Sep 25, 2018 · 17 comments
Closed

module not found #64

kishor-dabi opened this issue Sep 25, 2018 · 17 comments
Assignees
Labels
bug resolved The issue is resolved and ready to be realeased
Milestone

Comments

@kishor-dabi
Copy link

when using dataframe-js it give warning:

WARNING in ./node_modules/dataframe-js/lib/reusables.js
Module not found: Error: Can't resolve 'fs' in '/home/kishoredabi/Desktop/inv_master/core-web-inventory/core-web/node_modules/dataframe-js/lib'

@Gmousse Gmousse self-assigned this Sep 27, 2018
@Gmousse Gmousse added the bug label Sep 27, 2018
@Gmousse
Copy link
Owner

Gmousse commented Sep 27, 2018

Hi @kishor-dabi,
Thanks for using dataframe-js.
This warning occurs when you try to write a file when you are in the browser (where the module fs doesn't exist).
However the warning message seems wrong.

Can you give more informations about your usage ?

@kishor-dabi
Copy link
Author

@Gmousse
Thanks for reply,
I am Using dataframe-js in angular 6.
I have install dataframe-js using npm.
"npm i dataframe-js"

but it give warning at compile time and build time

WARNING in ./node_modules/dataframe-js/lib/reusables.js
Module not found: Error: Can't resolve 'fs' in '/home/kishoredabi/Desktop/inv_master/core-web-inventory/core-web/node_modules/dataframe-js/lib'

The version of datafrane-js and other is:
node : 8.11,
dataframe-js: ^1.3.2,
anlgular-cli: 6.1.3

@Gmousse Gmousse added this to the 1.4.0 milestone Dec 29, 2018
@maihannijat
Copy link

I have the same warning while compile. I do not write file at all.

@Gmousse
Copy link
Owner

Gmousse commented Jan 10, 2019

hi @maihannijat,
I m currently modifying the library build. It's possible that the new release can fix this.
Can you test with the branch feature/upgrade-babel ?

Thank you

@maihannijat
Copy link

maihannijat commented Jan 11, 2019

Steps taken:
1- Removed dataframe-js directory from node_modules
2- Installed with npm install git+https://github.com/Gmousse/dataframe-js.git#feature/upgrade-babel
3- Run the development environment

Result:

WARNING in ./node_modules/dataframe-js/lib/reusables.js
Module not found: Error: Can't resolve 'fs' in '/Users/mnijat/Desktop/oneplatform/frontend/node_modules/dataframe-js/lib'

Confirmation:
I have the following in package.json:
"dataframe-js": "git+https://github.com/Gmousse/dataframe-js.git#feature/upgrade-babel",

@Gmousse
Copy link
Owner

Gmousse commented Jan 11, 2019

Ok strange... I will continue to look for a solution .

@Gmousse
Copy link
Owner

Gmousse commented Jan 11, 2019

After looking a bit, it s related to webpack (or similar) which resolves the require fs at build time and fails even if the require has a try catch block.

Can you try to add:

In your webpack config:

node: {
    fs: "empty"
}

Or if you can t, in your package.json:

"browser": {
    "fs": false
}

If it works I will see if I can add it in the library s package.json.

@Gmousse Gmousse closed this as completed Jan 11, 2019
@Gmousse Gmousse reopened this Jan 11, 2019
@maihannijat
Copy link

Tried the following and it did not help:

"browser": {
    "fs": false
}

@Gmousse
Copy link
Owner

Gmousse commented Jan 11, 2019

Ok. Can you give me your webpack, node versions, and your webpack config (if possible) to reproduce this error. Indeed, on my side I can build with rollup or webpack without errors.

@maihannijat
Copy link

Node version: v10.9.0
I am using with the following project:
https://github.com/akveo/ngx-admin

You will get the error if you clone and add the package there.

@Gmousse
Copy link
Owner

Gmousse commented Jan 20, 2019

After a quick investigation, it seems its related to angular: angular/angular-cli#10681

Indeed, the require is clearly try catched in dataframe-js and should work anyway. It's related to how angular build its bundle.

It seems adding

"browser": {
    "fs": false
}

in the library package.json resolves your issue (I have no longer warning with your repository).
Could you try to reinstall "dataframe-js": "git+https://github.com/Gmousse/dataframe-js.git#feature/upgrade-babel", and retry ?

@maihannijat
Copy link

maihannijat commented Jan 23, 2019

The error is gone with above instructions but it broke my project. I get the following error in the browser console and the project does not load:

ERROR Error: "Uncaught (in promise): ReferenceError: global is not defined

I removed the package and installed the stable version and the project is running but with same warning.

@Gmousse
Copy link
Owner

Gmousse commented Jan 24, 2019

Sorry ! js environment can be a torment sometimes.

I will continue to work on it. Stay tuned.

@maihannijat it's a bit strange. I have cloned your repo, use my upgrade-babel branch and it seems to work (without displaying the warning anymore). I don't understand.

@Gmousse
Copy link
Owner

Gmousse commented Jan 26, 2019

Hi @maihannijat

My feature was merged with the develop branch. It works with your project (without the warning).
Feel free to test the develop branch (it can be cool to have feedbacks).

I will close the issue after the release 1.4.0 (in a week).

@Gmousse Gmousse added the resolved The issue is resolved and ready to be realeased label Jan 26, 2019
@bluehazetech
Copy link

Any ETA on when 1.4.0 will be released with this fix?

@Gmousse
Copy link
Owner

Gmousse commented Feb 17, 2019

Hi ! I will try to work on the library to release the 1.4.0 asap. This week I hope.
Could you try the develop branch ? The fix is merged.

@Gmousse
Copy link
Owner

Gmousse commented Feb 17, 2019

@bluehazetech I m working to deliver the 1.4.0 as soon as possible. Feel free to test the develop branch via #72

@Gmousse Gmousse closed this as completed Feb 17, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug resolved The issue is resolved and ready to be realeased
Projects
None yet
Development

No branches or pull requests

4 participants