android js shell,android - Cannot find module 'shelljs' when building Ionic App - Stack Overflow

在尝试构建 Android 平台时遇到了 'shelljs' 模块未找到的错误,尽管该模块已全局安装。虽然能够通过 Android Studio 运行项目,但在命令行中无法进行模拟。错误提示表明问题可能出在构建过程中。已列出已安装的 Node.js 模块,包括 cordova、ionic 和 shelljs 等。需要找到适配当前环境的解决方案以从命令行运行项目。
摘要由CSDN通过智能技术生成

When I build android platform I receive the error that shelljs module is not found, but that module is globally installed.

In fact, the android platform gets build and I can run the project from Android Studio, but... I'd like to be able to emulate from console and I can't do it because this error

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. (/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)

Here are the nodeJS modules that I have installed

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

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值