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

Uncaught (in promise) TypeError: forwardFunc is not a function #4

Open
anjanesh opened this issue Jun 26, 2021 · 16 comments
Open

Uncaught (in promise) TypeError: forwardFunc is not a function #4

anjanesh opened this issue Jun 26, 2021 · 16 comments

Comments

@anjanesh
Copy link

Today I did gh repo clone GantMan/learn-tfjs
I did npm i at chapter2/web/web-toxicity
http://localhost:1234/ shows : Uncaught (in promise) TypeError: forwardFunc is not a function

@GantMan
Copy link
Owner

GantMan commented Jun 26, 2021

Take a quick look at this fix, and let me know: tensorflow/tfjs#2329

@GantMan
Copy link
Owner

GantMan commented Jun 26, 2021

I just pulled down this chapter and ran npm i as well. The install went well, and then I did an npm start and it ran the page.

It appears the issue is local. I'll run the project on my laptop later this afternoon to verify.

@anjanesh
Copy link
Author

But what could the local issue be when the node/node-toxicity runs perfectly ?
It's only the web version that running into an issue. Its either typescript or parcel ?
I don't have @tensorflow/tfjs-node in /workspace/ML/learn-tfjs/chapter2/web/web-toxicity/package.json.

@hermano360
Copy link

I did two things to make this work. First was delete the existing package-lock.json and then I changed the dependency for the toxicity model from "@tensorflow-models/toxicity": "^1.2.2" to "@tensorflow-models/toxicity": "1.2.2" (removing the carrot)

@GantMan
Copy link
Owner

GantMan commented Aug 16, 2021

Thanks so much @hermano360

It looks like they might have made a mistake in semver.

Do either of you want to do a PR for credit?

@anjanesh
Copy link
Author

anjanesh commented Aug 16, 2021

I am still out of luck - I am using the simple an pure node examples.

@GantMan
Copy link
Owner

GantMan commented Aug 16, 2021

@anjanesh - I ran the code through CodeSandbox.io to assure it would work, and it does

LINK: https://codesandbox.io/s/chapter2-web-toxicity-ty8qj
Screenshot:
chapter 2 working

Hopefully that helps.

@hermano360
Copy link

@anjanesh do you have a repo with your changes we could take a look at?

@GantMan I'll look to add the PR if that's ok

@GantMan
Copy link
Owner

GantMan commented Aug 16, 2021

Sounds good @hermano360! Credit where credit is due.

I had hoped that the package-lock.json would have avoided errors like this, but it's obviously better to just modify package.json! Thanks for contributing.

@anjanesh
Copy link
Author

@anjanesh do you have a repo with your changes we could take a look at?
I didn't edit any code - I simply am running the code in GantMan's github repo.

So I tried this on my work laptop - Dell Windows 10 with node. It's all working as expected.
So this error is specific to my personal MacBook which is showing forwardFunc is not a function in FireFox, Chrome and Opera.

@hermano360
Copy link

@anjanesh.

Please see above. You need to delete the package-lock.json file and change the dependency for the toxicity model from "@tensorflow-models/toxicity": "^1.2.2" to "@tensorflow-models/toxicity": "1.2.2" (removing the caret).

@anjanesh
Copy link
Author

Yes hermano360 - I did that yesterday and reinstalled the node_modules. Still same error.
I think this is specific to my nodeJS version ? v14.17.5

@GantMan
Copy link
Owner

GantMan commented Aug 17, 2021

Is it the node folder that is failing? You had originally said it was the web folder. Your NodeJS version won't matter in the web folder. I know it can get a bit confusing.

@anjanesh
Copy link
Author

learn-tfjs/chapter2/node/node-toxicity works perfectly.

learn-tfjs/chapter2/web/web-toxicity returns the forwardFunc error even after trying various things to fix it including hermano360's method.

So, now I understand - it probably isn't the node issue but the same web code is working flawlessly on my Windows 10 laptop. So I don't get why it isn't on my MacBook Pro on all browsers - so I thought it had something to do with node.

@GantMan
Copy link
Owner

GantMan commented Aug 17, 2021

That's definitely strange. The error seems to happen when you have two versions of TFJS that are not compatible in the same repo, so maybe clean the npm cache with npm cache clean and then do a fresh npm i ?

@BekahHW
Copy link

BekahHW commented Aug 20, 2021

@anjanesh this is the only thing that's worked for me.

I'm running it on my macBook (Big Sur, Apple M1)

Edited for update

I needed to use node v16.7.0 to properly install the packages, otherwise I would error out.
And now it's working withimport "@tensorflow/tfjs"; and "@tensorflow-models/toxicity": "^1.2.2"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants