nodemon找不到模块'/path/to/project/home/index.js'

我在Linux机器上使用nodmeon version 1.9.1

我正在运行nodemon: nodemon --watch ./build其中我有我的index.js内容在生成文件夹。

但是当我运行nodemon的时候,它一直在项目的home文件夹中查找index.js文件,因此在那里找不到它。

我试图检查nodemon – 帮助更好的选项,但我没有看到任何,也写在package.json文件中的脚本对象,它仍然会引发同样的错误。

我也试图运行它作为nodemon --watch ./build/index.js仍然抛出错误。

另外index.js文件只包含一个console.log('hello world'); 只是为了确保它是nodemon本身。

你使用--watch抛出nodemon。

你告诉nodemon是“正常运行,并观看目录./build ”。 nodemon在--watch之后查找参数并find./build 。 然后它查找一个脚本,发现没有,因此使用默认。

Nodemon默认监视,所以你想运行的是nodemon ./build