Reputation: 1616
import * as tfn from '@tensorflow/tfjs-node
throws me followed warnings:
WARNING Compiled with 4 warnings 15:06:46
warning in ./node_modules/@tensorflow/tfjs-node/dist/index.js
Critical dependency: the request of a dependency is an expression
warning in ./node_modules/@mapbox/node-pre-gyp/lib/util/compile.js
Module not found: Error: Can't resolve 'node-gyp' in 'C:\Users\Username\Desktop\Team\my-app\node_modules\@mapbox\node-pre-gyp\lib\util'
warning in ./node_modules/@mapbox/node-pre-gyp/lib/util/compile.js
Module not found: Error: Can't resolve 'npm' in 'C:\Users\Username\Desktop\Team\my-app\node_modules\@mapbox\node-pre-gyp\lib\util'
warning in ./node_modules/@mapbox/node-pre-gyp/lib/util/nw-pre-gyp/index.html
Module parse failed: Unexpected token (1:0)
You may need an appropriate loader to handle this file type, currently no loaders are configured to process this file. See https://webpack.js.org/concepts#loaders
> <!doctype html>
Why is that? (vue: 2.7.8)
Webpack.config.js:
const path = require('path');
const nodeExternals = require('webpack-node-externals');
module.exports = {
entry: './server.js',
mode: 'production',
target: 'node',
externals: [nodeExternals()],
output: {
path: path.resolve(__dirname, '.'),
filename: 'server.bundle.js'
}
};
Package versions:
├── @tensorflow/[email protected]
├── @tensorflow/[email protected]
├── @tensorflow/[email protected]
├── @tensorflow/[email protected]
├── [email protected]
(Please let me know if you need information for further details)
Also tried a workaround with Windows Subsystem for Linux which gives me followed error:
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @tensorflow/[email protected] install: `node scripts/install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @tensorflow/[email protected] install script.
Upvotes: 1
Views: 305
Reputation: 7546
Based on your error, it's likely that you are using Python 3. According to the documentation, "Windows & OSX build support for node-gyp requires Python 2.7". In the event that you are using the correct version of Python, see the Windows troubleshooting guide for further troubleshooting information.
Conversely, you can use Windows Subsystem for Linux, and then interact with TensorFlow.js through Linux. My colleague on the team who uses Windows prefers this method, so I'd recommend it.
Upvotes: 1