簡體   English   中英

使用 NPM 啟動精簡服務器時出錯

[英]Error in starting the lite-server using NPM

npm 錯誤! 代碼 EJSONPARSE

npm 錯誤! 文件 C:\\Users\\thehitmanranjan\\Desktop\\git-test\\package.json

npm 錯誤! JSON.parse 解析 json 失敗

npm 錯誤! JSON.parse 解析 '{ 時在位置 240 處出現 JSON 中的意外字符串

npm 錯誤! JSON.parse "name": "git-test",

npm 錯誤! JSON.parse "version": "1.'

npm 錯誤! JSON.parse 無法解析 package.json 數據。

npm 錯誤! JSON.parse package.json 必須是實際的 JSON,而不僅僅是 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"之后缺少一個逗號"test": "echo \\"Error: no test specified\\" && exit 1"

此外,如果這不起作用,請嘗試將您的package.json重命名為package.json.old並重新執行npm init 它解決了我的問題。 我瘋狂了幾個小時試圖弄清楚。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM