nodemon app でサーバーを起動しようとすると
このようなエラーが出ます
user@fukusyun-2 graphQL % nodemon app [nodemon] 2.0.4 [nodemon] to restart at any time, enter `rs` [nodemon] watching path(s): *.* [nodemon] watching extensions: js,mjs,json [nodemon] starting `node app index.js` internal/modules/cjs/loader.js:968 throw err; ^ Error: Cannot find module '/Users/user/udemy/graphQL/index.js' at Function.Module._resolveFilename (internal/modules/cjs/loader.js:965:15) at Function.Module._load (internal/modules/cjs/loader.js:841:27) at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:71:12) at internal/main/run_main_module.js:17:47 { code: 'MODULE_NOT_FOUND', requireStack: [] } [nodemon] app crashed - waiting for file changes before starting...
初めてnodemonコマンドを使ったので
わからないことが多く、
同じようなエラーを見たのですが
解決策がわかりませんでした、、
package.json { "name": "graphql", "version": "1.0.0", "description": "", "main": "index.js", "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "", "license": "ISC", "dependencies": { "express": "^4.17.1", "mongoose": "^5.10.0", "nodemon": "^2.0.4" インストール確認 } }
一様app.js const express = require("express") const graphql = require("express-graphql") const mongoose = require("mongoose") const app =express() mongoose.connect('mongodb+srv://fukui:3578a@cluster0.uu61l.mongodb.net/<dbname>?retryWrites=true&w=majority') mongoose.connection.once('open', () =>{ console.log('db connected') }) mongoose.use('/graphql', graphqlHTTPS) app.use('/graphql',graphqlHTTP({ })) app.listen(4000, () =>{ console.log('listing part 4000') })
npm fixができません
audited 604 packages in 2.12s found 369 vulnerabilities (364 low, 2 moderate, 3 high) run `npm audit fix` to fix them, or `npm audit` for details user@fukusyun-2 calender-app % npm audit fix npm ERR! code EAUDITNOPJSON npm ERR! audit No package.json found: Cannot audit a project without a package.json npm ERR! A complete log of this run can be found in: npm ERR! /Users/user/.npm/_logs/2020-08-25T05_33_23_586Z-debug.log user@fukusyun-2 calender-app %
scriptの方を
"scripts": { "test": "echo \"Error: no test specified\" && exit 1", "start": "nodemon Server.js" }
にしてみたりといろいろいじったのですがダメでした
killall -9 node
コマンド後、でも同じく
試したコマンド
rm package-lock.json && npm i && npm audit fix
npm --prefix ./server install ./server
npm i minimatch -D
npm install npm-check-updates
npx ncu -u
npm update
npm outdated
npm audit fix
yarn add nodemon
yarn add graphql
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/08/25 01:59
退会済みユーザー
2020/08/25 03:56
2020/08/25 04:05
退会済みユーザー
2020/08/25 04:44
2020/08/25 04:59