首页 > 解决方案 > 未找到命令但模块存在

问题描述

我有一个节点模块 rimraf。它肯定存在基于能够单击它
并登陆它在 node_modules 下的文件夹。但我收到错误说 command not found
for rimraf

试图删除整个node_module。
还尝试了以下命令。

npm ci 

npm cache clear --force
npm i

没有错误,一些关于许可的警告消息和
没有找到模块驱动模块的存储库字段。

现在,当我运行以下命令时,我最终会遇到错误。

npm run build

错误

sh: rimraf: command not found
npm ERR! file sh
npm ERR! code ELIFECYCLE
npm ERR! errno ENOENT
npm ERR! syscall spawn
npm ERR! dyna-modules@0.2.0 build: `rimraf build && bundle-trace-app --clientConfig webpack/client.config.js --serverConfig webpack/server.config.js`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the dyna-module@0.2.0 build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

会是什么问题?考虑到rimraf 的存在?

标签: javascriptnode.jsnpm

解决方案


也许您可以尝试使用此命令

rm -rf node_modules package-lock.json
或在重新安装节点模块之前手动删除它


推荐阅读