使用 NPM 启动 lite-server 时出错
Error in starting the lite-server using NPM
npm ERR! code EJSONPARSE
npm ERR! file C:\Users\thehitmanranjan\Desktop\git-test\package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 240 while
parsing '{
npm ERR! JSON.parse "name": "git-test",
npm ERR! JSON.parse "version": "1.'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just
JavaScript.
这是我在发出命令 "npm start" 时遇到的错误。
我的 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/thehitmanranjan/git-test.git"
},
"author": "Pratik Ranjan",
"license": "ISC",
"bugs": {
"url": "https://github.com/thehitmanranjan/git-test/issues"
},
"homepage": "https://github.com/thehitmanranjan/git-test#readme",
"devDependencies": {
"lite-server": "^2.5.4"
}
}
这行后面少了一个逗号"test": "echo \"Error: no test specified\" && exit 1"
此外,如果这不起作用,请尝试将您的 package.json
重命名为 package.json.old
和 re-doing npm init
。它解决了我的问题。我发疯了几个小时试图弄明白。
npm ERR! code EJSONPARSE
npm ERR! file C:\Users\thehitmanranjan\Desktop\git-test\package.json
npm ERR! JSON.parse Failed to parse json
npm ERR! JSON.parse Unexpected string in JSON at position 240 while parsing '{
npm ERR! JSON.parse "name": "git-test",
npm ERR! JSON.parse "version": "1.'
npm ERR! JSON.parse Failed to parse package.json data.
npm ERR! JSON.parse package.json must be actual JSON, not just JavaScript.
这是我在发出命令 "npm start" 时遇到的错误。 我的 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/thehitmanranjan/git-test.git"
},
"author": "Pratik Ranjan",
"license": "ISC",
"bugs": {
"url": "https://github.com/thehitmanranjan/git-test/issues"
},
"homepage": "https://github.com/thehitmanranjan/git-test#readme",
"devDependencies": {
"lite-server": "^2.5.4"
}
}
这行后面少了一个逗号"test": "echo \"Error: no test specified\" && exit 1"
此外,如果这不起作用,请尝试将您的 package.json
重命名为 package.json.old
和 re-doing npm init
。它解决了我的问题。我发疯了几个小时试图弄明白。