Script fails in Webstorm but not from terminal

前端 未结 2 1990
耶瑟儿~
耶瑟儿~ 2020-12-30 06:07

I have a nodejs script that uses phantomjs-node to scrape a webpage. It works fine when I run from a terminal window, but not when I run from inside Webstorm via a run confi

相关标签:
2条回答
  • 2020-12-30 06:43

    Webstorm does set a PATH variable, but it's different to the PATH variable your app gets when run in the terminal. My solution, a hack:

    1. Type node to get to the REPL
    2. Run process.env
    3. Copy the contents of the PATH value
    4. Add an environment variable to Webstorm called PATH that uses this value. It will overwrite the default PATH variable that Webstorm gives your app.

    Done!

    0 讨论(0)
  • 2020-12-30 06:56

    If you are on Mac see http://devnet.jetbrains.net/docs/DOC-1160. This document was originally written for RubyMine, but it is applicable for WebStorm too.

    0 讨论(0)
提交回复
热议问题