node.js - npm 安装失败。云9IDE

标签 node.js express cloud9-ide npm-install

我在使用 npm 时遇到了同样的问题。在我的电脑上尝试尝试避免目录问题并在 cloud9 上遇到相同的问题。希望它在虚拟机上,我可以做点什么来搞砸它,我尝试过 private:true 和 falsi 并且完全没有它。以及sockt.io“最新”与express相同。任何见解都会很棒

{ "name": "chit",
 "version": "0.0.1",
 "description": "chat practice",
 "private": "false",
 "dependencies":{ "socket.io":"1.4.8",
 "express":"4.14.0" }
 "author": "Charles",
 "license": "ISC"  

非常感谢

查看错误

ERR! install Couldn't read dependencies
npm ERR! Linux 4.2.0-c9
npm ERR! argv "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/node" "/home/ubuntu/.nvm/versions/node/v4.4.5/bin/npm" "install"
npm ERR! node v4.4.5
npm ERR! npm  v2.15.5
npm ERR! file /home/ubuntu/workspace/chat/package.json
npm ERR! code EJSONPARSE

npm ERR! Failed to parse json
npm ERR! Unexpected token 'a' at 10:4
npm ERR!   "author": "Charles",
npm ERR!    ^
npm ERR! File: /home/ubuntu/workspace/chat/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!     /home/ubuntu/workspace/chat/npm-debug.log

最佳答案

这里缺少一个冒号:

{ "name": "chit",
"version": "0.0.1",
"description": "chat practice",
"private": "false",
"dependencies":{ "socket.io":"1.4.8",
"express":"4.14.0" } // <--- missing colon here
"author": "Charles",
"license": "ISC"

应该是:

{
    "name": "chit",
    "version": "0.0.1",
    "description": "chat practice",
    "private": "false",
    "dependencies": {
        "socket.io": "1.4.8",
        "express": "4.14.0"
    },
    "author": "Charles",
    "license": "ISC"
}

关于node.js - npm 安装失败。云9IDE,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/38365501/

相关文章:

javascript - 尝试使用 Express 设置 cookie 时我做错了什么

node.js - 如何在node js中获取浏览器中的url作为参数传给后端?

ruby-on-rails - 我是否需要额外的 gem 或可能需要运行以前版本的 gem?

node.js - 如何访问本地主机:9000 in cloud9 for Harp server ( Custom workspace )?

node.js - npm 请求 GET 参数

node.js - 在 Echo Show 上循环播放视频

javascript - Node.js中如何解压二进制数据

node.js - 在 Node.js 上使用 Passport.js 和 React.js 前端进行身份验证

javascript - Node JS Sequelize 连接查询

node.js - 如何使用npm superagent登录cloud9