不加载,不要使用try,我想检查一个模块是否安装
回复 (4)
B
have a way, you can check node_modules from current path and parent path.
签名: 交流群244728015 《Node.js 服务器框架开发实战》 http://url.cn/Pn07N3
R
引用 brighthashave a way, you can check node modules from current path and parent path. 签名: 交流群244728015 《Node...
如果没有其它方法,这个方法倒也不是不可以,但我想有更优雅的方式
B
npm list npm list express
X
检查文件存不存在,应该只有这个方法了。
参与回复
登录后即可参与回复。登录