1

My Node (6.9.0) script runs without issue when I'm in the module directory and use node bin/index.js.

However, when I try to run it from $PATH (either via creating a bin entry in package.json and using npm -g install . or npm link), I'm met with the following:

/home/peter/.nvm/versions/node/v6.9.0/bin/react-render-server: line 1: global.__RWR_ENV__: command not found
/home/peter/.nvm/versions/node/v6.9.0/bin/react-render-server: line 2: syntax error near unexpected token `'babel-core/register''
/home/peter/.nvm/versions/node/v6.9.0/bin/react-render-server: line 2: `require('babel-core/register');'
pdoherty926
  • 9,895
  • 4
  • 37
  • 68

1 Answers1

0

You'll need to include #!/usr/bin/env node at the top of your node script. See this post What does "#!/bin/env" mean (at the top of a node.js script)?

Community
  • 1
  • 1
Larry Turtis
  • 1,907
  • 13
  • 26