首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WSL :来自sudo apt安装的摩卡与新安装一起崩溃

WSL :来自sudo apt安装的摩卡与新安装一起崩溃
EN

Stack Overflow用户
提问于 2022-03-13 22:48:26
回答 2查看 204关注 0票数 0

如下面所示,我从which mocha状态开始,不返回任何内容(未安装),然后用sudo apt install mocha安装它,然后运行mocha,希望接收某种“使用/help选项获取更多信息”。

然而,相反,我收到了这个

错误:找不到模块“glob”

为什么会这样呢?

代码语言:javascript
复制
REDACTED:/mnt/d/SourceTree$ which mocha

REDACTED:/mnt/d/SourceTree$ sudo apt install mocha
Reading package lists... Done
Building dependency tree
Reading state information... Done
The following packages were automatically installed and are no longer required:
  gyp libauthen-sasl-perl libdata-dump-perl libencode-locale-perl libfile-basedir-perl libfile-desktopentry-perl libfile-listing-perl   
  libfile-mimeinfo-perl libfont-afm-perl libhtml-form-perl libhtml-format-perl libhtml-parser-perl libhtml-tagset-perl
  libhtml-tree-perl libhttp-cookies-perl libhttp-daemon-perl libhttp-date-perl libhttp-message-perl libhttp-negotiate-perl
  libio-html-perl libio-socket-ssl-perl libio-stringy-perl libipc-system-simple-perl libjs-is-typedarray libjs-psl
  libjs-typedarray-to-buffer liblwp-mediatypes-perl liblwp-protocol-https-perl libmailtools-perl libnet-dbus-perl libnet-http-perl      
  libnet-smtp-ssl-perl libnet-ssleay-perl libnode-dev libpython2-stdlib libpython2.7-minimal libpython2.7-stdlib libtie-ixhash-perl     
  libtimedate-perl libtry-tiny-perl liburi-perl libuv1-dev libwww-perl libwww-robotrules-perl libx11-protocol-perl libxml-parser-perl   
  libxml-twig-perl libxml-xpathengine-perl perl-openssl-defaults python-pkg-resources python2 python2-minimal python2.7
  python2.7-minimal python3-cliapp python3-markdown python3-packaging python3-pyparsing python3-ttystatus xdg-utils
Use 'sudo apt autoremove' to remove them.
Suggested packages:
  chai
The following NEW packages will be installed:
  mocha
0 upgraded, 1 newly installed, 0 to remove and 123 not upgraded.
Need to get 0 B/113 kB of archives.
After this operation, 675 kB of additional disk space will be used.
Selecting previously unselected package mocha.
(Reading database ... 72405 files and directories currently installed.)
Preparing to unpack .../mocha_7.0.1+ds1-2_all.deb ...
Unpacking mocha (7.0.1+ds1-2) ...
Setting up mocha (7.0.1+ds1-2) ...
Processing triggers for man-db (2.9.1-1) ...

REDACTED:/mnt/d/SourceTree$ mocha
node:internal/modules/cjs/loader:936
  throw err;
  ^

Error: Cannot find module 'glob'
Require stack:
- /usr/share/nodejs/mocha/lib/utils.js
- /usr/share/nodejs/mocha/bin/mocha
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:933:15)
    at Function.Module._load (node:internal/modules/cjs/loader:778:27)
    at Module.require (node:internal/modules/cjs/loader:1005:19)
    at require (node:internal/modules/cjs/helpers:102:18)
    at Object.<anonymous> (/usr/share/nodejs/mocha/lib/utils.js:15:12)
    at Module._compile (node:internal/modules/cjs/loader:1103:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1155:10)
    at Module.load (node:internal/modules/cjs/loader:981:32)
    at Function.Module._load (node:internal/modules/cjs/loader:822:12)
    at Module.require (node:internal/modules/cjs/loader:1005:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/share/nodejs/mocha/lib/utils.js',
    '/usr/share/nodejs/mocha/bin/mocha'
  ]
}
EN

回答 2

Stack Overflow用户

发布于 2022-03-14 00:42:44

试试这个:

npm安装--保存module_name (在我们的例子中是glob)

(npm安装-保存glob)

更多信息--已经有一个问题报告了这个错误消息:

票数 0
EN

Stack Overflow用户

发布于 2022-03-14 02:35:27

我注意到apt安装摩卡是安装v7.0.1。然而,最新的摩卡是v9+。

我最后所做的是安装npm版本的摩卡(在sudo apt remove mocha之后),并使用npx mocha运行摩卡。

对于更高版本的摩卡,此错误不会发生。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/71461463

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档