Closed davidshen84 closed 5 years ago
Experiencing the exact same issue....reverting back to 0.14.1 works for me
hi @davidshen84 and @djimoh5
@tensorflow/tfjs-data is part of the @tensorflow/tfjs union package. The error is because of angular-cli does not support modules in node like "fs" and "path". Original issue: https://github.com/angular/angular-cli/issues/10681
I tested locally and the "fs" can be resolve by adding "browser": { "fs": false, "path": false, "os": false}
in your package.json (original solution: https://github.com/angular/angular-cli/issues/8272#issuecomment-392777980)
Instead of asking our users to specify the browser field in their package.json
, we should update our tfjs-data/package.json
to have 'node-fetch':false, 'string_decoder':false and 'fs':false under package.browser
.
I found those 3 packages when I searched for 'require()' usages in tfjs-data repo.
@kangyizhang can you do that? Thanks!
@dsmilkov totally agree with you. Sent PR https://github.com/tensorflow/tfjs-data/pull/147
Why this error happens every time updated version???
@NiNJAD3vel0per are you still seeing this error? Could you make sure you remove node_modules and re-install?
i have same issues in my react app
I'm using speech-commands
(great work!) in a NextJS application. When loading the model like this in a component:
import * as speechCommands from '@tensorflow-models/speech-commands';
I get the same error: can't resolve 'fs'
. @kangyizhang's fix worked, but I'd rather not directly edit node_modules
. Adding the following to my next.config.js
solved the issue for me:
config.resolve.fallback = { fs: false };
To illustrate:
module.exports = (phase, { defaultConfig }) => {
const config = {
webpack: (config, { isServer }) => {
// plugin config, etc
config.resolve.fallback = { fs: false };
return config;
},
};
};
TensorFlow.js version
Browser version
Describe the problem or feature request
My Angular app was using tfjs@0.13.4. When I try to upgrade to
0.15.1
, I got this error when executing theng build
command. But I am not even using thetfjs-data
component.After I revert tfjs to 0.13.4, my code compiles and the app worked again.
Code to reproduce the bug / link to feature request
All the dependencies in my app.