【发布时间】:2014-06-12 01:13:21
【问题描述】:
我正在尝试在我的 Vagrant 机器(Ubuntu 机器)上使用 gulp,因此像这样安装它:
sudo apt-get install nodejs npm
sudo npm install -g gulp
但是在尝试 gulp -v 我得到了这个:
vagrant@laravel:/var/www$ gulp -v
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
Error: Cannot find module 'optimist'
at Function._resolveFilename (module.js:332:11)
at Function._load (module.js:279:25)
at Module.require (module.js:354:17)
at require (module.js:370:17)
at Object.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp:4:10)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
所以我另外跑了sudo npm install -g optimist。上面的错误已经解决了,但现在我被这个困住了:
vagrant@laravel:/var/www$ gulp -v
node.js:201
throw e; // process.nextTick error, or 'error' event on first tick
^
TypeError: undefined is not a function
at /usr/local/lib/node_modules/gulp/bin/gulp:26:12
at Array.filter (native)
at getGulpFile (/usr/local/lib/node_modules/gulp/bin/gulp:25:6)
at Object.<anonymous> (/usr/local/lib/node_modules/gulp/bin/gulp:8:18)
at Module._compile (module.js:441:26)
at Object..js (module.js:459:10)
at Module.load (module.js:348:32)
at Function._load (module.js:308:12)
at Array.0 (module.js:479:10)
at EventEmitter._tickCallback (node.js:192:41)
有什么想法吗?谢谢!
附言。这些是正在运行的版本:
vagrant@laravel:/var/www$ node -v
v0.6.12
vagrant@laravel:/var/www$ npm -v
1.1.4
【问题讨论】: