npm install lite-server语言 - -save-dev 安装错误



我是第一次尝试使用node,安装了node.js以下是信息

node -v
v14.4.0
npm -v
6.14.5

通过创建package.json文件完成设置,然后尝试使用命令安装精简服务器 npm install lite-server --save-dev 产生了以下错误:

npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR!     <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR!     C:UsersojhaaAppDataRoamingnpm-cache_logs2020-06-06T06_54_54_480Z-debug.log

其次 npm 缓存清理 --强制

这是 package.json 文件

{
"name": "git-test",
"version": "1.0.0",
"description": ""This is a test directory to learn git and node"",
"main": "index.html",
"scripts": {
"start": "npm run lite",
"test": "echo "Error: no test specified" && exit 1",
"lite": "lite-server"
},
"repository": {
"type": "git",
"url": "git+https://github.com/apoorva0212/git-test.git"
},
"author": ""Apoorva Ojha"",
"license": "ISC",
"bugs": {
"url": "https://github.com/apoorva0212/git-test/issues"
},
"homepage": "https://github.com/apoorva0212/git-test#readme"
}

但我仍然得到同样的错误。谁能帮我解决这个问题? 提前谢谢你。

你缺少对lite-server的依赖

尝试安装精简服务器依赖项

npm install lite-server --save-dev

然后调用npm run lite