最新消息: 电脑我帮您提供丰富的电脑知识,编程学习,软件下载,win7系统下载。

Nodemon一直在寻找index.js

IT培训 admin 8浏览 0评论

Nodemon一直在寻找index.js

我Nodemon不停地启动和寻找index.js,但我想用app.js,因为大多数人现在使用app.js

如何更新我的nodemon找app.js呢?

我试图卸载,重新安装没有帮助。


⚡️  vidjot  nodemon
[nodemon] 1.17.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
module.js:540
    throw err;
    ^

Error: Cannot find module '/Users/bheng/Sites/vidjot/index.js'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
[nodemon] app crashed - waiting for file changes before starting...

的package.json

{
  "name": "vidjot",
  "version": "1.0.0",
  "description": "app to create video idea",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.16.3"
  }
}
回答如下:

在你的主要财产Nodemon命令搜索的package.json文件,并试图执行它的文件。例:

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "henriquelborges",
  "license": "ISC"
}

你可以改变“主”:index.js”为‘主’:‘app.js nodemon文件名‘指定入口文件我最常做的是脚本添加到我的package.json例’或者你可以运行’。 :

"scripts": {
    "start": "node app.js",
    "test": "nodemon app.js"
},

这之后,我就在我的项目的根文件夹使用像“NPM启动”或“故宫测试”命令。像Heroku的云应用平台的需求“NPM启动”你的package.json以执行你的应用程序。添加NPM命令到你的项目也是有用的情况下你需要加载命令行其他NPM模块。

示例 - 你可以加载你的环境变量在本地主机与测试您的应用程序:

“测试”: “nodemon -r dotenv /配置app.js dotenv_config_path = / config.env”。

Nodemon一直在寻找index.js

我Nodemon不停地启动和寻找index.js,但我想用app.js,因为大多数人现在使用app.js

如何更新我的nodemon找app.js呢?

我试图卸载,重新安装没有帮助。


⚡️  vidjot  nodemon
[nodemon] 1.17.3
[nodemon] to restart at any time, enter `rs`
[nodemon] watching: *.*
[nodemon] starting `node index.js`
module.js:540
    throw err;
    ^

Error: Cannot find module '/Users/bheng/Sites/vidjot/index.js'
    at Function.Module._resolveFilename (module.js:538:15)
    at Function.Module._load (module.js:468:25)
    at Function.Module.runMain (module.js:684:10)
    at startup (bootstrap_node.js:187:16)
    at bootstrap_node.js:608:3
[nodemon] app crashed - waiting for file changes before starting...

的package.json

{
  "name": "vidjot",
  "version": "1.0.0",
  "description": "app to create video idea",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "express": "^4.16.3"
  }
}
回答如下:

在你的主要财产Nodemon命令搜索的package.json文件,并试图执行它的文件。例:

{
  "name": "app",
  "version": "1.0.0",
  "description": "",
  "main": "index.js",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "author": "henriquelborges",
  "license": "ISC"
}

你可以改变“主”:index.js”为‘主’:‘app.js nodemon文件名‘指定入口文件我最常做的是脚本添加到我的package.json例’或者你可以运行’。 :

"scripts": {
    "start": "node app.js",
    "test": "nodemon app.js"
},

这之后,我就在我的项目的根文件夹使用像“NPM启动”或“故宫测试”命令。像Heroku的云应用平台的需求“NPM启动”你的package.json以执行你的应用程序。添加NPM命令到你的项目也是有用的情况下你需要加载命令行其他NPM模块。

示例 - 你可以加载你的环境变量在本地主机与测试您的应用程序:

“测试”: “nodemon -r dotenv /配置app.js dotenv_config_path = / config.env”。

与本文相关的文章

发布评论

评论列表 (0)

  1. 暂无评论