当前位置: 首页 > 工具软件 > ShellJS > 使用案例 >

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

夏建木
2023-12-01

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

 类似资料: