简体   繁体   English

运行服务器时找不到模块'../lib/cli'错误

[英]Cannot find module '../lib/cli' error when running server

I am trying to run build a small express API. 我正在尝试构建一个小型Express API。 The problem is I am having problems trying to get the server up and running. 问题是我在尝试启动服务器并运行时遇到问题。 When I type npm start I get the following error. 当我输入npm start时,出现以下错误。

> nodemon ./index.js --exec babel-node -e js

module.js:557
throw err;
^

Error: Cannot find module '../lib/cli'

The script I have written in the in that package.json is the following. 我在package.json中编写的脚本如下。

"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"start":"nodemon ./index.js --exec babel-node -e js"
 },

Any help would be appreciated. 任何帮助,将不胜感激。

I needed to reinstall the node_modules. 我需要重新安装node_modules。

cd your_project_folder
rm -rf node_modules
npm install

There can be some issue with the node_modules. node_modules可能存在一些问题。 You must check your node_modules installation globally as well as locally inside project directory. 您必须全局以及在项目目录中本地检查node_modules的安装。

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

相关问题 错误:找不到模块“../lib/cli” - Error: Cannot find module '../lib/cli' 运行 webpack-dev-server 时找不到模块“webpack-cli/bin/config-yargs” - Cannot find module 'webpack-cli/bin/config-yargs' when running webpack-dev-server 运行Protractor时找不到模块'../built/cli.js' - Cannot find module '../built/cli.js' when running Protractor Gatsby 开发失败:错误:找不到模块“gatsby-cli/lib/reporter” - Gatsby Develop failing : Error: Cannot find module 'gatsby-cli/lib/reporter' 如何修复 Gatsby 开发错误:找不到模块“gatsby-cli/lib/reporter”? - How To Fix Gatsby Develop Error: Cannot find module 'gatsby-cli/lib/reporter'? 为什么在运行 nodejs express 服务器时出现错误:找不到模块 'html'? - Why do I get Error: Cannot find module 'html' when running nodejs express server? 运行Gulp抛出错误“无法找到模块'./lib/_stream_writable.js'” - Running Gulp throws error “Cannot find module './lib/_stream_writable.js'” 在我的应用程序上运行“ng serve”时“找不到模块‘@angular/compiler-cli/ngcc’” - "Cannot find module '@angular/compiler-cli/ngcc'" when running "ng serve" on my app 错误:运行“http”时找不到模块“moduleIntro.js” - Error: Cannot find module “moduleIntro.js” when running “http” 运行测试用例时出现节点错误“找不到模块” - Node error 'Cannot find module' when running test case
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM