Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
303 views
in Technique[技术] by (71.8m points)

node.js - Cordova: You may not have the required environment or OS to run this project

On Linux Mint 17.1 x86_64, Cordova v4.3.0 gives this error:

$ cordova run android

Running command: /home/naman/test/platforms/android/cordova/run 
WARNING : No target specified, deploying to emulator
WARNING : no emulator specified, defaulting to Sample
Waiting for emulator...
Booting up emulator (this may take a while)....BOOT COMPLETE

/home/naman/test/platforms/android/cordova/node_modules/q/q.js:126
                throw e;
                      ^
Error: ENOENT, no such file or directory '/opt/software/android-sdk/tools/tools/lib/build.template'
    at Object.fs.openSync (fs.js:432:18)
    at Object.fs.readFileSync (fs.js:286:15)
    at /home/naman/test/platforms/android/cordova/lib/build.js:129:40
    at _fulfilled (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:798:54)
    at self.promiseDispatch.done (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:827:30)
    at Promise.promise.promiseDispatch (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:760:13)
    at /home/naman/test/platforms/android/cordova/node_modules/q/q.js:574:44
    at flush (/home/naman/test/platforms/android/cordova/node_modules/q/q.js:108:17)
    at process._tickCallback (node.js:415:13)
ERROR running one or more of the platforms: Error: /home/naman/test/platforms/android/cordova/run: Command failed with exit code 8
You may not have the required environment or OS to run this project

PATH variable seems to be alright (the path for SDK is correct):

$ echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/opt/software/android-sdk/tools:/opt/software/android-sdk/platform-tools

I installed it using :

sudo apt-add-repository ppa:cordova-ubuntu/ppa
sudo apt-get update
sudo apt-get install cordova-cli
npm install -g cordova

The installation went smoothly and the project was created without any error. Am I missing some dependency?

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Reply

0 votes
by (71.8m points)

You may need to uninstall the existing app on your device.

I installed my app on that device from another computer. When I run cordova run android I get

You may not have the required environment or OS to run this project.

But when I try to install my apk by adb it told my that the app was already installed. So I uninstalled it an it worked.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
OGeek|极客中国-欢迎来到极客的世界,一个免费开放的程序员编程交流平台!开放,进步,分享!让技术改变生活,让极客改变未来! Welcome to OGeek Q&A Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...