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

  • 相关阅读:
    关于搭建系统直播和Thinkphp的杂谈(持续更新)
    linux下phpstudy的搭建以及网站的搭建
    java大文件读写操作,java nio 之MappedByteBuffer,高效文件/内存映射
    IntelliJ IDEA 破解
    遍历表格
    Ajax简单示例
    [转shasiqq]@Param 注解在Mybatis中的使用 以及传递参数的三种方式
    一些python学习的链接
    python Scrapy安装错误解决
    SEVERE: Error configuring application listener of class org.springframework.web.context.ContextLoade
  • 原文地址:https://www.cnblogs.com/chucklu/p/14177984.html
Copyright © 2011-2022 走看看