GithubHelp home page GithubHelp logo

Comments (11)

spadeworkers avatar spadeworkers commented on August 23, 2024

I went ahead and started the same script in bash, and the script successfully finds the forever command, but not node:

/usr/bin/env: node: No such file or directory

Anyone have an ideas?

from forever.

AvianFlu avatar AvianFlu commented on August 23, 2024

@spadeworkers: your individual user account seems to have a node path set in your bash environment, but the user trying to run the cron job, sometimes a separate cron user, doesn't. You could either try to change the path settings for the cron user, or only give cron fully qualified paths.

Let me know if this is still a problem or if you have other questions.

from forever.

spadeworkers avatar spadeworkers commented on August 23, 2024

Thanks for the response. I realize I should have added the -c argument to the command adding the full path to the node app. Though even after I did that I am still getting the node error. Even the list command returns the same error. The command I'm running is:

/usr/local/lib/node/.npm/forever/0.4.1/package/bin/forever -v -c /home/xxxxx/node/node list

Error is:

/usr/bin/env: node: No such file or directory

Its as if the -c argument is not working.

from forever.

indexzero avatar indexzero commented on August 23, 2024

@spadeworkers The -c option is only for the executable that you want any processed to be spawned with. The problem is here (I suspect): https://github.com/indexzero/forever/blob/master/bin/forever#L1

I'm not sure the best way to make this run across multiple possible node locations. @AvianFlu do you know if its possible to replace:

#!/usr/bin/env node

with something like:

#!which node

from forever.

AvianFlu avatar AvianFlu commented on August 23, 2024

@indexzero: it would have to be #! /usr/bin/which node , but I don't otherwise see a problem.

from forever.

indexzero avatar indexzero commented on August 23, 2024

@AvianFlu This doesn't seem to work. I modified and linked my local forever and tried forever list. The output was unexpected and is below:

$ forever list
/usr/local/bin/node
/usr/local/bin/forever

from forever.

indexzero avatar indexzero commented on August 23, 2024

@spadeworkers I believe I have found a solution to your problem. Can you try running

  $ node `which forever` list

I'm not sure the right approach to fixing this in forever core. A comment from anyone with serious bash-fu would be welcome.

from forever.

AvianFlu avatar AvianFlu commented on August 23, 2024

I have encountered the same - which used in a hashbang results in the string, rather than the command being executed.

/usr/bin/env actually adds node to the environment before running it - provided the shell in question has something useful to associate the word node with. The real question is how to make sure node is in a given user's path so that the shell knows what to do.

from forever.

AvianFlu avatar AvianFlu commented on August 23, 2024

Having one's absolute node path in the hashbang would work for this. #!/usr/bin/node or what have you.

from forever.

spadeworkers avatar spadeworkers commented on August 23, 2024

@indexzero I ran the command you suggested:

node `which forever` list

and it works fine from the command line, but then I had this run from the cron:

/usr/local/bin/node `which forever` list

and I get this error:

node.js:134
   throw e; // process.nextTick error, or 'error' event on first tick
   ^
Error: Cannot find module '/home/xxxxx/list'
   at Function._resolveFilename (module.js:320:11)
   at Function._load (module.js:266:25)
   at Array.<anonymous> (module.js:423:10)
   at EventEmitter._tickCallback (node.js:126:26)
1

'/home/xxxxx/' is the home folder for the user under which the cron job is running

from forever.

indexzero avatar indexzero commented on August 23, 2024

This should be fixed in the 0.6.x branch

from forever.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.