简体   繁体   English

接收找不到模块错误,我该如何解决?

[英]Receiving cannot find module error, how do I fix it?

const { getIo } = require('services/socketio');
const restful = require('utils/restful');
const publicApiService = require('services/publicApi');
const accessTokenMiddleware = require('middleware/accessToken');
const validateSessionCookieMiddleware = require('middleware/validateSessionCookie');
const logger = require('utils/logger');

package.json:包.json:

"scripts": {
        "start": "node ./bin/www",
        ...

}

I get this error:我收到此错误:

 internal/modules/cjs/loader.js:796
    throw err;

^

Error: Cannot find module 'services/socketio'

I tried running set NODE_PATH=./lib in terminal but it doesn't fix it.我尝试在终端中运行 set NODE_PATH=./lib 但它没有修复它。

您的本地模块应以./开头 - 因此将其更改为'./services/publicApi'

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 如何修复显示“找不到模块'mailosaur'”的错误 - How do i fix an error that reads "Cannot find module 'mailosaur'" react-scripts 启动错误(找不到模块'../scripts/start') - 我该如何解决这个问题? - react-scripts start error (Cannot find module '../scripts/start') - how can i fix this? 如何修复“错误:找不到模块'./src/bot/index'” - how to fix "Error: Cannot find module './src/bot/index'" 如何修复运行“找不到模块”错误的 docker 容器? - How to fix docker container running 'cannot find module' error? 如何修复 Node JS 错误 cannot find module 'express' on heroku? - How to fix Node JS error cannot find module 'express' on heroku? 如何修复错误nodejs express cannot find module./response - How to fix the error nodejs express cannot find module ./response 如何修复“找不到模块 './commands/${file}'” - How can i fix “Cannot find module './commands/${file}'” 我正在尝试运行 node.js,如何解决“找不到模块”错误? - I am trying to run node.js, how do I resolve "Cannot find module" error? 如何修复在 Angular 4 中找不到模块“打字稿”? - How to fix Cannot find module 'typescript' in Angular 4? 我如何解决我的Typescript版本中的错误“找不到模块'jquery'” - How do i solve error “cannot find module 'jquery'” in my Typescript build
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM