2

I'm working a raspberry pi project including Alexa Builtin (https://github.com/alexa/alexa-avs-sample-app/wiki/Raspberry-Pi). Everything is working but the startup script I'm working on

#! /bin/bash

lxterminal -e "cd companionService && npm start" &
lxterminal -e "cd javaclient && mvn exec:exec" &
lxterminal -e "cd wakeWordAgent/src && ./wakeWordAgent -e sensory" &

but when I run it, I get this

npm ERR! Error: ENOENT, open '/home/pi/Desktop/alexa-avs-sample-app/samples/package.json'
npm ERR! If you need help, you may report this *entire* log,
npm ERR! including the npm and node versions, at:
npm ERR!     <http://github.com/npm/npm/issues>
npm ERR! System Linux 4.4.50-v7+
npm ERR! command "/usr/bin/nodejs" "/usr/bin/npm" "start"
npm ERR! cwd /home/pi/Desktop/alexa-avs-sample-app/samples
npm ERR! node -v v0.10.29
npm ERR! npm -v 1.4.21
npm ERR! path /home/pi/Desktop/alexa-avs-sample-app/samples/package.json
npm ERR! code ENOENT
npm ERR! errno 34
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /home/pi/Desktop/alexa-avs-sample-app/samples/npm-debug.log
npm ERR! not ok code 0
[INFO] Scanning for projects...
[INFO]                                                                         
[INFO] ------------------------------------------------------------------------
[INFO] Building Maven Stub Project (No POM) 1
[INFO] ------------------------------------------------------------------------
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time: 1.434s
[INFO] Finished at: Mon Apr 03 16:43:32 UTC 2017
[INFO] Final Memory: 5M/15M
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal org.codehaus.mojo:exec-maven-plugin:1.6.0:exec (default-cli): Goal requires a project to execute but there is no POM in this directory (/home/pi/Desktop/alexa-avs-sample-app/samples). Please verify you invoked Maven from the correct directory. -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MissingProjectException
./Alexa.sh: line 5: ./wakeWordAgent: Is a directory

and 3 terminal window open, but nothing is in them, can't even do Ctrl+C!

And yes, I did make sure it was pointing to the right file location

Any help would be very much appreciated!

Bora

EDIT: I also tried xterm but it came out as bash: xterm: command not found .

  • 1
    You use commands like cd companionService; this isn't a good idea because that means that there's one and only one current working directory from which this command will work; if you're in any other directory it will fail. Use the full path to filenames or directories in scripts unless you do a cd first. – Curt J. Sampson Apr 15 '17 at 15:37
  • Ditto. Especially if you plan to copy this script to your /usr/bin directory where it can be run anytime from anywhere. Always use fully-qualified pathnames for everything. Of course, ~/ is your $HOME directory. That's always safe to use. – SDsolar Aug 13 '17 at 0:29
2

For working out stuff like this it's best to find the simplest possible test that still reproduces the problem; for me that was:

$ mkdir dir
$ cat > dir/script
#!/usr/bin/env bash
echo "I am a script!"
^D
$ chmod +x dir/script

Running xterm -e 'cd dir && ./script; read x' works fine for me. (Note that I added the read x at the end so that it pauses until you hit Enter in that window, otherwise it closes up immediately after running.) You can install xterm by running sudo apt-get install xterm and that should work fine for you as well.

The reason it's not working with lxterminal is that, while xterm passes the -e argument to a shell to be interpreted, lxterminal appears not to do so, and also appears to be deficient in terms of reporting errors related to this. Having lxterminal run bash, and giving the script as a parameter to bash, made it work for me

lxterm -e 'bash -c "cd dirname && some-command; read x"'
  • I installed xterm but the same errors were appearing. – Biba Baba Apr 14 '17 at 11:40

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.