“ npm watch”命令无效,但“ npm run watch”命令有效

编程入门 行业动态 更新时间:2024-10-08 06:28:09

“ npm watch”<a href=https://www.elefans.com/category/jswz/34/1771323.html style=命令无效,但“ npm run watch”命令有效"/>

“ npm watch”命令无效,但“ npm run watch”命令有效

它说npm startnpm run start相同,那么在我的情况下,npm run watch正常工作,但npm watch不工作,

以下是我运行npm watch时出现的错误:

Usage: npm <command>

where <command> is one of:
    access, adduser, audit, bin, bugs, c, cache, ci, cit,
    clean-install, clean-install-test, completion, config,
    create, ddp, dedupe, deprecate, dist-tag, docs, doctor,
    edit, explore, fund, get, help, help-search, hook, i, init,
    install, install-ci-test, install-test, it, link, list, ln,
    login, logout, ls, org, outdated, owner, pack, ping, prefix,
    profile, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, team, test, token, tst, un,
    uninstall, unpublish, unstar, up, update, v, version, view,
    whoami

npm <command> -h  quick help on <command>
npm -l            display full usage info
npm help <term>   search for help on <term>
npm help npm      involved overview

Specify configs in the ini-formatted file:
    C:\Users\erdiv\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

[email protected] C:\Program Files\nodejs\node_modules\npm

我的package.json是:

{
  "name": "web",
  "version": "1.0.0",
  "description": "",
  "main": "main.js",
  "scripts": {
    "start": "nodemon server.js",
    "watch": "npx watchify ./public/main.js -o ./public/bundle.js"
  },
  "author": "",
  "license": "ISC",
  "dependencies": {
    "budo": "^11.6.3",
    "express": "^4.17.1",
    "nodemon": "^2.0.3",
    "socket.io": "^2.3.0",
    "watchify": "^3.11.1"
  }
}

请您澄清一下,在这种情况下为什么我不能使用命令“ npm watch”。

回答如下:

因为您需要运行手表!

更多推荐

“ npm watch”命令无效,但“ npm run watch”命令有效

本文发布于:2024-05-07 13:07:23,感谢您对本站的认可!
本文链接:https://www.elefans.com/category/jswz/34/1756381.html
版权声明:本站内容均来自互联网,仅供演示用,请勿用于商业和其他非法用途。如果侵犯了您的权益请与我们联系,我们将在24小时内删除。
本文标签:命令   npm   watch   run

发布评论

评论列表 (有 0 条评论)
草根站长

>www.elefans.com

编程频道|电子爱好者 - 技术资讯及电子产品介绍!