2021年1月21日星期四

Error [ERR_MODULE_NOT_FOUND] [ERR_MODULE_NOT_FOUND]: Cannot find module

Why i Cannot find module 'C:\Users\Josh\Desktop\ethiks-api\src\graphql\schema' in imported from C:\Users\Josh\Desktop\ethiks-api\src\server.js ?? did i miss something? please help me to configure this error. thanks, the error Error [ERR_MODULE_NOT_FOUND] [ERR_MODULE_NOT_FOUND]: Cannot find module

|-graphql    |_schema    |-coach    |-country    |-event  |-service    |_readSigned      |_index.js    |_uploadSigned      |_index.js    |_index.js  |-server.js  

this is my grapql/schema.js

import 'regenerator-runtime/runtime'  import merge from 'lodash.merge'  import { gql } from 'apollo-server-express'      import Coach from './coach'  import Country from './country'  import Event from './event'      const typeDef = gql`    type Query    type Mutation  `    export default {    typeDefs: [      typeDef,      Coach.typeDefs,      Country.typeDefs,      Event.typeDefs,      ],    resolvers: merge(      Coach.resolvers,      Country.resolvers,      Event.resolvers,      )  }  

this is my server.js

import express from 'express'  import helmet from 'helmet'  import cors from 'cors'  import { ApolloServer } from 'apollo-server-express'  import schema from './graphql/schema'  import service from './service/index'      const app = express();    const {    SERVERPORT = 8085,  } = process.env    app.use(helmet())  app.use(cors())  app.use(express.json({ limit: '50mb' }))  app.use(express.urlencoded({ limit: '50mb', extended: true }))    const server = new ApolloServer({    typeDefs: schema.typeDefs,    resolvers: schema.resolvers,    context: (req) => ({ req }),    debug: process.env.NODE_ENV !== 'production',  })    app.get('/', (req, res) => res.send('Hello World!'))  app.get('/generate-upload', service.uploadSigned)  app.get('/read-upload', service.readSigned)    server.applyMiddleware({ app })    process.on('unhandledRejection', (error) => {    console.log('Unhandled Rejection', error)  })    app.listen(SERVERPORT, () => {    console.log(`App listening to ${SERVERPORT} in ${process.env.NODE_ENV}`)  })  

this is my service/index.js

import uploadSigned from './uploadSigned'  import readSigned from './readSigned'    export default {    uploadSigned,    readSigned,  }  

enter image description here

https://stackoverflow.com/questions/65837999/error-err-module-not-found-err-module-not-found-cannot-find-module January 22, 2021 at 09:06AM

没有评论:

发表评论