How to run node app with sublime text

前端 未结 6 734
旧巷少年郎
旧巷少年郎 2021-02-03 12:38

How would you run node app with sublime text? Like this, open the file app.js in sublime, go to menu->tools->build, and it just runs. Simple like that

6条回答
  •  無奈伤痛
    2021-02-03 12:55

    What is going on is that you don't have the right PATH setup for your terminal.

    try this command in a regular terminal:

    > which node
    

    I peronaly get this:

    /usr/local/bin/node
    

    As you can see this path is not in you environement path to add it in a regular terminal you would edit .bashrc or .bash_profile and add this line

    export PATH=/usr/local/bin:$PATH
    

    Here well you just have to look at the doc and find out that you need to modify the configuration file.

    If you have a JavaScript file open, by selecting selecting Tools -> Build Systems -> Nodejs and then hitting Ctrl + B, you will activate the node build system on your file and node will try to run it. You may need to add a path variable to the settings object for this if your node executable is not found

    Look at this.

提交回复
热议问题