“ npm watch”命令不起作用,但是“ npm run watch”命令起作用

时间:2020-05-12 18:48:45

标签: javascript node.js npm package.json watchify

它说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

npm@6.13.4 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”。

0 个答案:

没有答案