# Node-red won't start - invalid directory

**URL:** <https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260>\
**Category:** General\
**Created:** [21 March 2019 04:11 UTC](https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260 "2019-03-21T04:11:59Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![mladams922](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mladams922/32/6967_2.png) [@mladams922](https://discourse.nodered.org/u/mladams922)\
**Post date:** [21 March 2019 04:11 UTC](https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260/1 "2019-03-21T04:11:59Z")

</div>

I needed to re-install node-red so I completely removed nodejs, npm, and node-red. I then went through the install process again by first installing nodejs (version 10.x), then using npm to install node-red via the command:

sudo npm install -g --unsafe-perm node-red node-red-admin

I then went to run node red with the command: node-red

The error I got was "/usr/local/bin/node-red: No such file or directory".

Can anyone tell me why I'm getting this error? It appears I have node-red in my /usr/bin directory. So why does my installation seem to think it should be looking elsewhere?

Any pointers are appreciated.

Thanks

---

<div class="post-metadata">

**Author:** ![ukmoose](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/ukmoose/32/13_2.png) [@ukmoose](https://discourse.nodered.org/u/ukmoose)\
**Post date:** [21 March 2019 04:51 UTC](https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260/2 "2019-03-21T04:51:56Z")

</div>

You don’t say which versions of node npm you installed or which operating system you installed on.

All might be useful in identifying what went wrong, as would the output from the npm command

---

<div class="post-metadata">

**Author:** ![bakman2](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/bakman2/32/6207_2.png) [@bakman2](https://discourse.nodered.org/u/bakman2)\
**Post date:** [22 March 2019 18:08 UTC](https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260/3 "2019-03-22T18:08:21Z")

</div>

If you are installing on a Pi, follow:  
[https://nodered.org/docs/hardware/raspberrypi](https://nodered.org/docs/hardware/raspberrypi)

---

<div class="post-metadata">

**Author:** ![mladams922](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/mladams922/32/6967_2.png) [@mladams922](https://discourse.nodered.org/u/mladams922)\
**Post date:** [22 March 2019 22:10 UTC](https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260/4 "2019-03-22T22:10:05Z")

</div>

I appologize.  
OS: Ubundu 16.04 LTS  
npm: 6.4.1  
node: 10.15.3

Output after npm install command:  
/usr/bin/node-red -\> /usr/lib/node\_modules/node-red/red.js  
/usr/bin/node-red-pi -\> /usr/lib/node\_modules/node-red/bin/node-red-pi  
/usr/bin/node-red-admin -\> /usr/lib/node\_modules/node-red-admin/node-red-admin.js

- node-red-admin@0.1.5
- node-red@0.20.3  
updated 2 packages in 19.865s

Interestingly enough though the issue seemed to resolve itself. I tried uninstalling everything and removing all directories corresponding to the install. Then I ran the install again (including re-installing NodeJS according to the node-red website). I still had issues. Uninstalled again, re-installed, still had issues, that's when I posted.

I gave it a rest over night, and in the morning ran "sudo npm remove --purge node-red node-red-admin" to purge everything out. Also I ran a "sudo apt-get remove --purge nodejs" to clear out all node-js installs. Then I went back to the node-red website and again followed the steps for the ubuntu install and this time it works. I'm not sure what happened differently this time from the last few times I attempted but it seems to work now.

Thanks for being willing to assist!

---

<div class="post-metadata">

**Author:** ![Colin](https://sea2.discourse-cdn.com/flex026/user_avatar/discourse.nodered.org/colin/32/17040_2.png) [@Colin](https://discourse.nodered.org/u/Colin)\
**Post date:** [22 March 2019 22:20 UTC](https://discourse.nodered.org/t/node-red-wont-start-invalid-directory/9260/5 "2019-03-22T22:20:11Z")

</div>

For future reference the Pi install script generally works fine on Ubuntu.
