npm saveError ENOENT: no such file or directory

Posted xiluonanfeng

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了npm saveError ENOENT: no such file or directory相关的知识,希望对你有一定的参考价值。

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 [email protected] No description
npm WARN [email protected] No repository field.
npm WARN [email protected] 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": ""
},
}

 



























以上是关于npm saveError ENOENT: no such file or directory的主要内容,如果未能解决你的问题,请参考以下文章

npm install报错 npm ERR! enoent ENOENT: no such file or directory

npm ERR! enoent ENOENT: no such file or directory, rename

cnmp安装失败,报错npm ERR! enoent ENOENT: no such file or directory,

npm WARN enoent ENOENT: no such file or directory, open 'C:Userspackage.json'

npm安装socket.io时报错的解决方法(npm WARN enoent ENOENT: no such file or directory, open '/usr/local/nodej

Error:npm WARN enoent ENOENT: no such file or directory, open ‘C:UsersXXpackage.json‘son‘