npm mysql enoent_npm saveError ENOENT: no such file or

1、报错情况

在执行npm install xxx时,出现如下:

npm WARN saveError ENOENT: no such file or directory, open '/nodetest1/package.json'

npm WARN enoent ENOENT: no such file or directory, open '/nodetest1/package.json'

2、原因

项目目录中没有package.json

3、解决

使用 npm init -f 命令来生成一个package.json

4、生成package.json在执行npm install xxx

npm WARN nodetest1@1.0.0 No description

npm WARN nodetest1@1.0.0 No repository field.

npm WARN file-explorer@0.0.1 No repository field or no license field

5、显示缺少description描述和repository字段

根据模板package.json,添加description中的值以及repository字段

{

"name": "WeiXinNode",

"version": "1.0.0",

"description": "description字段",

"main": "index.js",

"dependencies": {

"koa": "^2.1.0",

"sha1": "^1.1.1"

},

"devDependencies": {},

"scripts": {

"test": "echo \"Error: no test specified\" && exit 1"

},

"keywords": [],

"author": "",

"license": "ISC",

"repository": { ------repository

"type": "",

"url": ""

},

}

本文链接:https://my.lmcjl.com/post/938.html

展开阅读全文

4 评论

留下您的评论.