zoukankan      html  css  js  c++  java
  • nodemon command is not recognized in terminal for node js server

    nodemon command is not recognized in terminal for node js server

    You need to install it globally

    npm install -g nodemon
    # or if using yarn
    yarn global add nodemon
    

    And then it will be available on the path (I see now that you have tried this and it didn't work, your path may be messed up)

    If you want to use the locally installed version, rather than installing globally then you can create a script in your package.json

    "scripts": {
        "serve": "nodemon server.js"
      },
    

    and then use

    npm run serve
    

    optionally if using yarn

    # without adding serve in package.json
    yarn run nodemon server.js
    # with serve script in package.json
    yarn run serve
    

    npm will then look in your local node_modules folder before looking for the command in your global modules

    安装

    npm install -g nodemon
    npm WARN deprecated fsevents@2.1.3: Please update to v 2.2.x
    C:UserscluAppDataRoaming pm odemon -> C:UserscluAppDataRoaming pm ode_modules odemonin odemon.js

    > nodemon@2.0.6 postinstall C:UserscluAppDataRoaming pm ode_modules odemon
    > node bin/postinstall || exit 0

    Love nodemon? You can now support the project via the open collective:
    > https://opencollective.com/nodemon/donate

    npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules odemon ode_moduleschokidar ode_modulesfsevents):
    npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

    + nodemon@2.0.6
    added 119 packages from 53 contributors in 34.983s

    https://github.com/remy/nodemon

    Monitor for any changes in your node.js application and automatically restart the server - perfect for development

    nodemon is a tool that helps develop node.js based applications by automatically restarting the node application when file changes in the directory are detected.

    nodemon does not require any additional changes to your code or method of development. nodemon is a replacement wrapper for node. To use nodemon, replace the word node on the command line when executing your script.

    Monitoring multiple directories

    By default nodemon monitors the current working directory. If you want to take control of that option, use the --watch option to add specific paths:

    nodemon --watch app --watch libs app/server.js

    Now nodemon will only restart if there are changes in the ./app or ./libs directory. By default nodemon will traverse sub-directories, so there's no need in explicitly including sub-directories.

    Don't use unix globbing to pass multiple directories, e.g --watch ./lib/*, it won't work. You need a --watch flag per directory watched.

    Specifying extension watch list

    By default, nodemon looks for files with the .js, .mjs, .coffee, .litcoffee, and .json extensions. If you use the --exec option and monitor app.py nodemon will monitor files with the extension of .py. However, you can specify your own list with the -e (or --ext) switch like so:

    nodemon -e js,pug

    Now nodemon will restart on any changes to files in the directory (or subdirectories) with the extensions .js, .pug.

    nodemon --watch src -e html,vue,js,scss,css build/build.js

  • 相关阅读:
    多数据源报表解析之简单多源报表
    8.5.4 Optimizing InnoDB Redo Logging 优化InnoDB Redo Logging
    8.5.2 Optimizing InnoDB Transaction Management
    8.5.1 Optimizing Storage Layout for InnoDB Tables
    Linux_RHEL7_YUM
    Linux_RHEL7_YUM
    Python基本语法_函数_返回值
    Python基本语法_函数_返回值
    8.4 Optimizing Database Structure 优化数据库结构
    8.3.7 InnoDB and MyISAM Index Statistics Collection InnoDB 和MyISAM 索引统计信息收集
  • 原文地址:https://www.cnblogs.com/chucklu/p/14177984.html
Copyright © 2011-2022 走看看