# Error: Cannot find module '/home/$USER/red.js'

**URL:** <https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525>\
**Category:** General\
**Created:** [17 February 2022 09:32 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525 "2022-02-17T09:32:57Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [17 February 2022 09:32 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525/1 "2022-02-17T09:32:57Z")

</div>

Hi,

I am a Node-RED user and I use it regularly, although I haven't been able to access Node-RED for a few days, since I get the following error:

```auto
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: Error: Cannot find module '/home/qmf/red.js'
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: at Function.Module._load (internal/modules/cjs/loader.js:667:27)
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: at internal/main/run_main_module.js:17:47 {
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: code: 'MODULE_NOT_FOUND',
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: requireStack: []
> de febr. 17 09:57:53 industrialshields Node-RED[15788]: }
> de febr. 17 09:57:53 industrialshields systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
> de febr. 17 09:57:53 industrialshields systemd[1]: nodered.service: Failed with result 'exit-code'.
> de febr. 17 09:58:13 industrialshields systemd[1]: nodered.service: Scheduled restart job, restart counter is at 1.
> de febr. 17 09:58:13 industrialshields systemd[1]: Stopped Node-RED graphical event wiring tool.
> de febr. 17 09:58:13 industrialshields systemd[1]: Started Node-RED graphical event wiring tool.
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: internal/modules/cjs/loader.js:818
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: throw err;
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: ^
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: Error: Cannot find module '/home/qmf/red.js'
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:815:15)
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: at Function.Module._load (internal/modules/cjs/loader.js:667:27)
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: at Function.executeUserEntryPoint [as runMain] (internal/modules/run_main.js:60:12)
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: at internal/main/run_main_module.js:17:47 {
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: code: 'MODULE_NOT_FOUND',
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: requireStack: []
> de febr. 17 09:58:13 industrialshields Node-RED[15808]: }
> de febr. 17 09:58:13 industrialshields systemd[1]: nodered.service: Main process exited, code=exited, status=1/FAILURE
> de febr. 17 09:58:13 industrialshields systemd[1]: nodered.service: Failed with result 'exit-code'.

```

And when I "sudo systemctl status nodered.service", I get that the service is constantly activating.

Anyways, I can run 'node-red' and it works. So, it is the service that it doesn't, but that is what I want.

I don't know if it's a coincidence or not, but these days I've updated to version 2.2, and I've also installed FlowForge on my computer.

Could you help me please?

Thank you,

Q.

---

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [17 February 2022 10:08 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525/2 "2022-02-17T10:08:07Z")

</div>

This is also what I see when I run:  
sudo systemctl status nodered

```auto
● nodered.service - Node-RED graphical event wiring tool
     Loaded: loaded (/lib/systemd/system/nodered.service; disabled; vendor preset: enabled)
     Active: activating (auto-restart) (Result: exit-code) since Thu 2022-02-17 11:06:54 CET; 3s ago
       Docs: http://nodered.org/docs/hardware/raspberrypi.html
    Process: 20636 ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS (code=exited, status=1/FAILURE)
   Main PID: 20636 (code=exited, status=1/FAILURE)

```

If it helps!

---

<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:** [17 February 2022 11:17 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525/3 "2022-02-17T11:17:40Z")

</div>

What h/w and OS are you using and how did you install node-red?

Post the log from before the error you show, starting from the Welcome to node-red message. Depending how you installed node red you may be able to get the log in a terminal using  
`node-red-stop`  
`node-red-start`

---

<div class="post-metadata">

**Author:** ![quemf](https://avatars.discourse-cdn.com/v4/letter/q/97f17d/32.png) [@quemf](https://discourse.nodered.org/u/quemf)\
**Post date:** [18 February 2022 11:52 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525/4 "2022-02-18T11:52:16Z")

</div>

Thank you Colin, but finally I solved it by going to the **/lib/systemd/system/nodered.service** and commenting the

`#ExecStart=/usr/bin/env node $NODE_OPTIONS red.js $NODE_RED_OPTIONS`

and discommenting the:  
`ExecStart=/usr/bin/env node-red-pi $NODE_OPTIONS $NODE_RED_OPTIONS`

Thank you anyways!

---

<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:** [18 February 2022 15:47 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525/5 "2022-02-18T15:47:45Z")

</div>

Had you previously changed it? What you have now is the default file contents.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex026/uploads/nodered/original/1X/d073cd938eafa2e558d7c2cd59003b3ef4963033.png) [@system](https://discourse.nodered.org/u/system)\
**Post date:** [4 March 2022 15:48 UTC](https://discourse.nodered.org/t/error-cannot-find-module-home-user-red-js/58525/6 "2022-03-04T15:48:09Z")

</div>

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.
