简体   繁体   中英

Tensorflow with Angular 7 : Failed to compile

我正在尝试将Tensorflow.js与Angular(v7)一起使用,但是ng构建失败并出现错误: ERROR in ./node_modules/@tensorflow/tfjs-data/dist/tf-data.esm.js Module not found: Error: Can't resolve 'fs' in ...

A hacky fix is adding:

"browser": {
  "fs": false,
  "path": false,
  "os": false
}

to your package.json .

I also had this issue. I think the fix mentioned above should work, but I personally fixed it changing:

node: false,

By:

node: {fs: 'empty'},

In the line 133 (method getBrowserConfig) of the file located at node_modules/@angular_devkit/build-angular/src/angular-cli-files/models/webpack-configs/browser.js

This bug looks like something new, as it happens to me while using tfjs 0.15.0, but didn't happen before when I was using the version 0.13.1.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM