build立离子应用程序时找不到模块'shelljs'

当我build立android平台时,我收到shelljs模块找不到的错误,但是这个模块是全局安装的。

事实上,Android平台得到构build,我可以从Android Studio运行项目,但是…我想能够从控制台模拟,我不能这样做,因为这个错误

MacBook-Pro-de-Ruben-5:TransportMe rubdottocom$ sudo ionic build android Running command: /Users/rubdottocom/Documents/AndroidStudio/TransportMe/hooks/after_prepare/010_add_platform_class.js /Users/rubdottocom/Documents/AndroidStudio/TransportMe add to body class: platform-android Running command: /Users/rubdottocom/Documents/AndroidStudio/TransportMe/platforms/android/cordova/build module.js:338 throw err; ^ Error: Cannot find module 'shelljs' at Function.Module._resolveFilename (module.js:336:15) at Function.Module._load (module.js:278:25) at Module.require (module.js:365:17) at require (module.js:384:17) at Object.<anonymous> (/Users/rubdottocom/Documents/AndroidStudio/TransportMe/platforms/android/cordova/lib/build.js:24:15) at Module._compile (module.js:460:26) at Object.Module._extensions..js (module.js:478:10) at Module.load (module.js:355:32) at Function.Module._load (module.js:310:12) at Module.require (module.js:365:17) ERROR building one of the platforms: Error: /Users/rubdottocom/Documents/AndroidStudio/TransportMe/platforms/android/cordova/build: Command failed with exit code 1 You may not have the required environment or OS to build this project Error: /Users/rubdottocom/Documents/AndroidStudio/TransportMe/platforms/android/cordova/build: Command failed with exit code 1 at ChildProcess.whenDone (/usr/local/lib/node_modules/cordova/node_modules/cordova-lib/src/cordova/superspawn.js:134:23) at ChildProcess.emit (events.js:110:17) at maybeClose (child_process.js:1015:16) at Process.ChildProcess._handle.onexit (child_process.js:1087:5) 

这里是我已经安装的nodeJS模块

 MacBook-Pro-de-Ruben-5:TransportMe rubdottocom$ npm -g ls --depth=0 /usr/local/lib ├── bower@1.4.1 ├── chromeos-apk@3.0.0 ├── coffee-script@1.6.3 ├── cordova@5.1.1 ├── gulp@3.9.0 ├── ionic@1.6.4 ├── less@1.3.1 ├── lungo@0.1.5 ├── mocha@1.7.0 ├── n@2.0.1 ├── npm@2.11.3 ├── phonegap@5.1.1 ├── shelljs@0.5.1 └── volo@0.2.10 

最后我解决了这个问题,从头开始删除和添加平台android。

由于某些原因,代码被破坏或缺less一些参考,我不知道。

注意不要丢失一些重要的代码或文件,因为会重新生成一切:P