nodemon keeps looking for index.js file even if i specified otherwise, thus throwing error.

Created on 19 Apr 2016  路  4Comments  路  Source: remy/nodemon

Hello,
when i run nodemon ./build
I get Error: Cannot find module /path/to/project/home/index.js while i've explicitly specified that it should check in the build/ directory, this is persisting even when i write nodemon ./build/index.js.

In the build/index.js i only have a console.log('hello world'); string.

Note: this error is not in nodemon: 1.8.1.

Am I missing something?

All 4 comments

I just can't reproduce your problem:

mkdir build
echo 'console.log("Hello World")' > build/index.js
nodemon ./build

Which starts nodemon:

[nodemon] 1.9.1
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node ./build`
Hello World
[nodemon] clean exit - waiting for changes before restart

It seems you didn't give us all the information. Is there anything special you didn't mention?

yeah, i'm sorry but i'm just stupid sometimes.
I just placed nodemon in scripts and after multiple attempts of installing and unistalling nodemon
I ended up running nodemon instead of npm run nodemon ..
Thank you for taking your time tho, you opened my eyes. hehehe

I know it might this not be relevant right now, however this is google result 2 for the issue, but I had this issue as well.

The problem was that I copied a config file off of stackoverflow like follows:

```package.json
"scripts": {
"dev": "nodemon --config nodemon.json"
},

```nodemon.json
{
    "verbose": true,
    "execMap": {
        "js": "node --harmony"
    },
    "script": "server.js",
    "ext": "js mustache"
}

The issue is that the package.json really needs to be

package.json "scripts": { "dev": "nodemon --config nodemon.json server.js" },

Hope this helps someone.

FWIW, I ran into this same error but added the following as a script in packages.json:

"start": "nodemon -w server server/server.js"

After this, I could run: npm start successfully.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

Bastorx picture Bastorx  路  5Comments

dimsmol picture dimsmol  路  4Comments

Mohammad-Quanit picture Mohammad-Quanit  路  5Comments

remy picture remy  路  5Comments

medoix picture medoix  路  4Comments