npm clean cache -f 命令报错

问题:加载Vue项目,使用npm clean cache -f报错:

npm WARN using --force Recommended protections disabled.
Unknown command: "clean"

To see a list of supported npm commands, run:
npm help

解决流程:

1. 查看npm版本

$ npm -v
8.11.0

2. 网上有人说版本过高,需要降低版本. 我觉得没有必要. 估计是命令更新啦

$ npm help
npm <command>

Usage:

npm install install all the dependencies in your project
npm install <foo> add the <foo> dependency to your project
npm test run this project's tests
npm run <foo> run the script named <foo>
npm <command> -h quick help on <command>
npm -l display usage info for all commands
npm help <term> search for help on <term>
npm help npm more involved overview

All commands:

access, adduser, audit, bin, bugs, cache, ci, completion,
config, dedupe, deprecate, diff, dist-tag, docs, doctor,
edit, exec, explain, explore, find-dupes, fund, get, help,
hook, init, install, install-ci-test, install-test, link,
ll, login, logout, ls, org, outdated, owner, pack, ping,
pkg, prefix, profile, prune, publish, rebuild, repo,
restart, root, run-script, search, set, set-script,
shrinkwrap, star, stars, start, stop, team, test, token,
uninstall, unpublish, unstar, update, version, view, whoami

Specify configs in the ini-formatted file:
/home/fs-user/.npmrc
or on the command line via: npm <command> --key=value

More configuration info: npm help config
Configuration fields: npm help 7 config

3. 发现使用npm cache作为命令开头

npm cache clean -f

 

解决结果:

问题解决成功, 没事多看help, 不要老看CSDN

 

posted @ 2022-07-11 15:50  DerekChen517  阅读(13639)  评论(0编辑  收藏  举报