最新消息:雨落星辰是一个专注网站SEO优化、网站SEO诊断、搜索引擎研究、网络营销推广、网站策划运营及站长类的自媒体原创博客

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

网站源码admin19浏览0评论

“ npm watch”命令无效,但“ 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”。

回答如下:

因为您需要运行手表!

发布评论

评论列表(0)

  1. 暂无评论