在Ubuntu下,npm run start时遇到:lite-server: not found,npm ERR! code ELIFECYCLE

本文解决了一个关于使用npm安装pet-shop项目时出现的错误问题。主要问题是由于lite-server未找到导致的安装失败。通过清理缓存、删除并重新安装node_modules等步骤解决了此问题。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

> pet-shop@1.0.0 dev /home/lihanyu/vote/pet-shop-box
> lite-server

sh: 1: lite-server: not found

npm ERR! Linux 4.15.0-46-generic
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "run" "dev"
npm ERR! node v6.16.0
npm ERR! npm  v3.10.10
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! pet-shop@1.0.0 dev: `lite-server`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the pet-shop@1.0.0 dev script 'lite-server'.
npm ERR! Make sure you have the latest version of node.js and npm installed.
npm ERR! If you do, this is most likely a problem with the pet-shop package,
npm ERR! not with npm itself.
npm ERR! Tell the author that this fails on your system:
npm ERR!     lite-server
npm ERR! You can get information on how to open an issue for this project with:
npm ERR!     npm bugs pet-shop
npm ERR! Or if that isn't available, you can get their info via:
npm ERR!     npm owner ls pet-shop
npm ERR! There is likely additional logging output above.
npm WARN Local package.json exists, but node_modules missing, did you mean to install?

npm ERR! Please include the following file with any support request:
npm ERR!     /home/lihanyu/vote/pet-shop-box/npm-debug.log

下面部分摘自:https://stackoverflow.com/questions/42308879/npm-err-code-elifecycle 可去该问题下看更多人详细的介绍,我只摘取了认可度最高的那个答案。

Step 1: $ npm cache clean --force

Step 2: delete node_modules by $ rm -rf node_modules folder or delete it manually by going into the directory and right-click > delete.(一定注意,这个node_modules是项目文件里的那个,而不是nodejs下的那个,删错了可就凉凉了,重新配环境,如果你没有在项目文件里找到node_modules,那说明你之前压根就没有执行过npm install,那问题就简单了,可以直接下一步

Step 3: npm install

To start again, $ npm start

This worked for me. Hopes it works for you too.

PS: Still if it is there, kindly check the error it displays in red and act accordingly. This error is specific to node.js environment. Happy Coding!!

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值