我在用脑子。js库,用于创建Nural网络。包安装完美,但当我运行服务器然后我得到这个错误。
找不到模块gpu。js
然后我安装了“npm i gpu。js”然后我得到了这个错误-下面的错误说安装Visual Studio 2022最新版本并在其中运行这个。我做了,但没有工作。
代码部分
npm WARN deprecated uuid@3.4.0: Please upgrade to version 7 or higher. Older versions may use Math.random() in certain circumstances, which is known to be problematic. See https://v8.dev/blog/math-random for details.
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm ERR! code 1
npm ERR! path C:\Users\priya\JSAIML\ytHelper\node_modules\gl
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c prebuild-install || node-gyp rebuild
npm ERR! gyp info it worked if it ends with ok
npm ERR! gyp info using node-gyp@7.1.2
npm ERR! gyp info using node@18.8.0 | win32 | x64
npm ERR! gyp info find Python using Python version 3.10.3 found at "C:\Users\priya\AppData\Local\Programs\Python\Python310\python.exe"
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS msvs_version not set from command line or npm config
npm ERR! gyp ERR! find VS VCINSTALLDIR not set, not running in VS Command Prompt
npm ERR! gyp ERR! find VS could not use PowerShell to find Visual Studio 2017 or newer, try re-running with '--loglevel silly' for more details
npm ERR! gyp ERR! find VS looking for Visual Studio 2015
npm ERR! gyp ERR! find VS - not found
npm ERR! gyp ERR! find VS not looking for VS2013 as it is only supported up to Node.js 8
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS You need to install the latest version of Visual Studio
npm ERR! gyp ERR! find VS including the "Desktop development with C++" workload.
npm ERR! gyp ERR! find VS For more information consult the documentation at:
npm ERR! gyp ERR! find VS https://github.com/nodejs/node-gyp#on-windows
npm ERR! gyp ERR! find VS **************************************************************
npm ERR! gyp ERR! find VS
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: Could not find any Visual Studio installation to use
npm ERR! gyp ERR! stack at VisualStudioFinder.fail (C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:121:47)
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:74:16
npm ERR! gyp ERR! stack at VisualStudioFinder.findVisualStudio2013 (C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:351:14)
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:70:14
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\find-visualstudio.js:372:16
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\util.js:54:7
npm ERR! gyp ERR! stack at C:\Users\priya\JSAIML\ytHelper\node_modules\node-gyp\lib\util.js:33:16npm ERR! gyp ERR! stack at ChildProcess.exithandler (node:child_process:420:5)
npm ERR! gyp ERR! stack at ChildProcess.emit (node:events:513:28)
npm ERR! gyp ERR! stack at maybeClose (node:internal/child_process:1091:16)
npm ERR! gyp ERR! System Windows_NT 10.0.22000
npm ERR! gyp ERR! command "C:\\Users\\priya\\.nvm\\versions\\node\\v18.8.0\\bin\\node.exe" "C:\\Users\\priya\\JSAIML\\ytHelper\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\Users\priya\JSAIML\ytHelper\node_modules\gl
npm ERR! gyp ERR! node -v v18.8.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\priya\AppData\Local\npm-cache\_logs\2023-01-08T17_34_38_565Z-debug-0.log```
this is how my code looks like
code ->
import express from 'express';
import * as brain from 'brain.js/dist/index.js';
import dotenv from 'dotenv'
import ytData from './md/data.js';
dotenv.config()
const app = express()
const PORT = process.env.PORT || 8000
const network = new brain.recurrent.LSTM();
const trainingData = ytData.map((item,i)=>({
input : item.title,
output : item.views,
}))
network.train(trainingData,{iterations : 2000});
const outputData = network.run("Simple Machine Learning With JavaScript - Brain.js")
app.get('/',(req,res)=>{
// res.json({message : `On this title you will probably get around ${outputData} views`})
res.send("hello")
})
app.listen(PORT, ()=>{
console.log(`Running up the hill at ${PORT}km/hr`)
})
**Any help will be appreciated.**
1条答案
按热度按时间odopli941#
我也经历过类似的痛苦。
为了解决这个问题,我做了以下事情:
“npm ERR! code 1”
错误。我不知道这部分是否与你有关,但我需要它:nvm
,然后运行:nvm install v15.14.0
nvm use v15.14.0
brain.js
,以解决Cannot find module 'gpu.js'
错误:package.json
:"brain.js": "^1.6.1"
npm install brain.js
node index.js
好的-希望这对我们有帮助:)