您的位置:首页 > Web前端 > Node.js

NodeJS - npm WARN package.json : No repository field:can not open package.json

2017-03-09 17:42 906 查看
最近在研究node.js,在安装npm的时候发现了几个报错,瞬间蒙圈,查找文献基本解决(文献好少呀~ -。-)

一、报错:“can not open path/path/package.json”

原因:在安装npm的时候,终端会调取一个叫package.json的文件,里边包含了 name,version,dependencies 等等属性信息,当终端找不到该文件的时候也就不能完成安装操作。

解决方法:在对应的path下边创建该文件,并且把需要的模块写在dependencies属性里,比如

"dependencies": { "express": "4.15.2"}


。然后使用npm install创建就好了。

二、 No repository field 这个问题如下解答,不想翻译了,筒子们可以自己看~~~(有时间也许会回头翻一下 =、=)

In this post we are going to discuss about npm warning message "npm WARN package.json No repository field". This warning comes up when you are trying to install any npm packages. This is just a warning so actually you do not have to worry about it.



This warning means that the package does not have the repository field in the package.json. This field is used just for informational purposes. Suppose you are an author of a package and you are getting this error, you can write the below code in your package.json to remove this warning.

"repository": {

"type" : "git",

"url" : "Your_Package_URL"

}

According to NPM , repository means the place where your code lives. This is helpful for people who wants to contribute. If the git repository is on GitHub, then the npm docs command will be able to find you.



You can also check the issues already logged https://github.com/npm/npm/issues/3568
. Please Like and Share the Blog, if you find it interesting and helpful.

原文点这里 PC_package.json
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: 
相关文章推荐