Greetings and apologies for any inconvenience caused by my relatively trivial inquiries. I am currently navigating the introductory stages of delving into front-end development.
Presently, I have initiated a hello-world vite app, which came to life through these simple steps:
npm init @vitejs/app
cd hello-vite
npm install npm run dev
Successfully, I can observe the outputted localhost
URL in my browser.
In addition, there exists a basic script within my repertoire that imports tensorflow and proceeds with tasks:
$ cat test.mjs
import * as tf from '@tensorflow/tfjs-node'
const a = tf.tensor([[1, 2], [3, 4]]);
a.print();
$ node test.mjs
2022-06-27 22:04:16.968270: I tensorflow/core/platform/cpu_feature_guard.cc:151] This TensorFlow binary is optimized with oneAPI Deep Neural Network Library (oneDNN) to use the following CPU instructions in performance-critical operations: AVX2 AVX512F FMA
To enable them in other operations, rebuild TensorFlow with the appropriate compiler flags.
Tensor
[[1, 2],
[3, 4]]
The next objective I aim to achieve is integrating this behavior from test.mjs
into my hello-vite
app. Hence, I ventured into executing something along these lines:
$ cat main.ts
import './style.css'
import * as tf from '@tensorflow/tfjs-node'
const a = tf.tensor([[1, 2], [3, 4]]);
a.print();
document.querySelector('#app').innerHTML = `
<h1>Hello Vite!!!</h1>
<a href="https://vitejs.dev/guide/features.html" target="_blank">Documentation</a>
`
Yet, upon running npm run dev
, it appears discontent and unleashes complaints about AWS-related issues:
$ npm run dev
> <a href="/cdn-cgi/l/email-protection" class="__cf_email__" data-cfemail="6f070a0303004219061b0a2f5f415f415f">[email protected]</a> dev
> vite
vite v2.9.12 dev server running at:
> Local: http://localhost:3000/
> Network: use `--host` to expose
ready in 112ms.
✘ [ERROR] Could not resolve "mock-aws-s3"
node_modules/@mapbox/node-pre-gyp/lib/util/s3_setup.js:43:28:
43 │ const AWSMock = require('mock-aws-s3');
╵ ~~~~~~~~~~~~~
You can mark the path "mock-aws-s3" as external to exclude it from the bundle, which will remove
this error. You can also surround this "require" call with a try/catch block to handle this
failure at run-time instead of bundle-time.
...
If I choose to omit the print()
function call and the preceding line, the errors cease to arise.
Where could I be going astray? How should I interpret and address these complications?