在我的ubuntu系统上 nodejs verison是v0.10.25而nop版本是1.3.10 。但是,当我尝试安装mochajs进行测试时,我收到了以下错误
user@ubuntu:~/mochatest$ sudo npm install -g mocha
npm ERR! Error: Cannot find module 'fstream'
npm ERR! at Function.Module._resolveFilename (module.js:338:15)
npm ERR! at Function.Module._load (module.js:280:25)
npm ERR! at Module.require (module.js:364:17)
npm ERR! at require (module.js:380:17)
npm ERR! at Object.<anonymous> (/usr/lib/nodejs/tar/lib/entry.js:14:15)
npm ERR! at Module._compile (module.js:456:26)
npm ERR! at Object.Module._extensions..js (module.js:474:10)
npm ERR! at Module.load (module.js:356:32)
npm ERR! at Function.Module._load (module.js:312:12)
npm ERR! at Module.require (module.js:364:17)
npm ERR! If you need help, you may report this log at:
npm ERR! <http://github.com/isaacs/npm/issues>
npm ERR! or email it to:
npm ERR! <npm-@googlegroups.com>
npm ERR! System Linux 3.13.0-36-generic
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "install" "-g" "mocha"
npm ERR! cwd /home/mochatest
npm ERR! node -v v0.10.25
npm ERR! npm -v 1.3.10
npm ERR! code MODULE_NOT_FOUND
npm ERR!
npm ERR! Additional logging details can be found in:
npm ERR! /home/mochatest/npm-debug.log
npm ERR! not ok code 0
答案 0 :(得分:0)
我不知道您的设置尝试安装哪个版本的mocha,因为对我来说摩卡不依赖于fsteam
├─┬ mocha@2.3.3
│ ├── commander@2.3.0
│ ├─┬ debug@2.0.0
│ │ └── ms@0.6.2
│ ├── diff@1.4.0
│ ├── escape-string-regexp@1.0.2
│ ├─┬ glob@3.2.3
│ │ ├── graceful-fs@2.0.3
│ │ ├── inherits@2.0.1
│ │ └─┬ minimatch@0.2.14
│ │ ├── lru-cache@2.7.0
│ │ └── sigmund@1.0.1
│ ├── growl@1.8.1
│ ├─┬ jade@0.26.3
│ │ ├── commander@0.6.1
│ │ └── mkdirp@0.3.0
│ ├─┬ mkdirp@0.5.0
│ │ └── minimist@0.0.8
│ └── supports-color@1.2.0
也许npm需要它...尝试用npm安装它,如果它不起作用,请考虑重新安装nodejs。
另外,也许相关,你在MacOS上吗?如果是,请确保/var/lib/node_modules
和~/.npm
拥有正确的权利。