简体   繁体   English

NPM安装-package.json错误

[英]NPM Install - package.json error

I am trying to create a local server for visual studio code through Node by following Microsoft's Blog Post . 我正在尝试通过遵循Microsoft的Blog Post通过Node创建用于Visual Studio代码的本地服务器。 I followed these very simple instructions exactly by adding a package.json file in my root folder and running npm install first. 我完全按照这些非常简单的说明进行操作,方法是在根文件夹中添加package.json文件,然后首先运行npm install。 When I do, I get the following error: 当我这样做时,出现以下错误:

$ npm install
npm ERR! Windows_NT 10.0.14393
npm ERR! argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
npm ERR! node v6.10.2
npm ERR! npm  v3.10.10
npm ERR! file C:\Users\Temple\desktop\secret\package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token '“' at 2:4
npm ERR!    “name”: “Demo”,
npm ERR!    ^
npm ERR! File: C:\Users\Temple\desktop\secret\package.json
npm ERR! Failed to parse package.json data.
npm ERR! package.json must be actual JSON, not just JavaScript.
npm ERR!
npm ERR! This is not a bug in npm.
npm ERR! Tell the package author to fix their package.json file. JSON.parse

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Users\Temple\desktop\secret\npm-debug.log

And yes, I have node installed. 是的,我已经安装了节点。

您正在使用错误的类型引号(窗型)使用该字符: "

It looks like you edited the package.json with an editor that automatically uses "smart quotes" (like Microsoft Word, for example). 看起来您使用自动使用“智能引号”的编辑器(例如Microsoft Word)编辑了package.json Try retyping the characters in Notepad, for example, and see if it works then. 例如,尝试重新键入记事本中的字符,然后查看它是否有效。

The error message in you package.json You must use double quotes. package.json中的错误消息必须使用双引号。 Check and validate your package.json file in here 此处检查并验证您的package.json文件

It looks like when you copy pasted 看起来像当您复制粘贴时

"name": "Demo”,

it got changed to 它变成了

“name”: “Demo”,

The problem is with the quotes. 问题出在引号上。 Replace all instances of or with " , and you should be good. 将所有实例替换为 " ,您应该会很好。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM