Node.js   发布时间:2022-04-24  发布网站:大佬教程  code.js-code.com
大佬教程收集整理的这篇文章主要介绍了node.js – 无法在节点js中安装依赖项大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
即时学习节点js,我刚刚做了一个教程,我试图创建一个聊天,一切都很好,直到我陷入教程的一步.我决定下载教程的源代码来运行serven,看看问题我有一个名为curso的文件在这文件夹中我有两个文件夹ona es chatnodejs,其他是sourcechatjs,在聊天nodejs我有packasge.json和服务器js,我跑了npminstall,一切都很好.但是,当我下载聊天源时,我把它放在sourcechatjs中,我打开了temirnal并运行了npm install并得到了这个错误.

jhonnatans-MACBook-Pro:chat jhonnatan$npm install
npm ERR! install Couldn't read dependencies
npm ERR! Failed to parse json
npm ERR! Unexpected token /
npm ERR! File: /Users/jhonnatan/Documents/cursoseccion2/clasenodejs/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! System Darwin 12.3.0  
npm ERR! command "node" "/usr/local/bin/npm" "install"
npm ERR! cwd /Users/jhonnatan/Documents/cursoseccion2/clasenodejs/chat
npm ERR! node -v v0.10.0
npm ERR! npm -v 1.2.14
npm ERR! file /Users/jhonnatan/Documents/cursoseccion2/clasenodejs/chat/package.json
npm ERR! code EJSONPARSE
npm ERR! 
npm ERR! Additional logging details can be found in:
npm ERR!     /Users/jhonnatan/Documents/cursoseccion2/clasenodejs/chat/npm-debug.log
npm ERR! not ok @R_565_6756@

这就是我的json的样子

{
// Aca definiremos nuestro package.json,lo primero es el nombre
"name": "curso",// Luego la version del mismo
"version": "0.0.1",// Ahora las dependencias,normalmente podrias hacer esto con npm pero es mucho mejor tener claro y ejecutar eStricatemente las necesaria
"dependencies": {
    // Express el cual se encargara de ser nuestro framework en node
    "express": "",//los tipos de vista,jade parecido al que usa ruby on rails y swig parecido al que usa django
    "jade": "","swig": "",// El que se encargara de renderizar los templates en un contexto
    "consolidate": "",// y por ultimo el encargado de manejar los sockets :)
    "socket.io": ""
}

}

iv一直在尝试很多,但我非常不知道可能会出现什么问题,我会感激有人可以让我知道这个问题!

解决方法

你不能在 JSON文件中有评论.

删除注释行// …它应该工作.

大佬总结

以上是大佬教程为你收集整理的node.js – 无法在节点js中安装依赖项全部内容,希望文章能够帮你解决node.js – 无法在节点js中安装依赖项所遇到的程序开发问题。

如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。