简体   繁体   English

npm 命令提示符安装

[英]npm command prompt Installing

I'm new to nodejs, I tried typing npm install and it brought this error log:我是 nodejs 的新手,我尝试输入 npm install 并带来了这个错误日志:

npm warn saveerror ENOENT: no such file or directory, npm warn saveerror ENOENT: 没有这样的文件或目录,
open C:\\users\\kiddy\\package.json打开 C:\\users\\kiddy\\package.json
npm WARN kiddy no description npm WARN Kiddy 没有描述
npm WARN kiddy no repository field npm WARN Kiddy 没有存储库字段
Npm WARN kiddy no README data Npm WARN Kiddy 没有 README 数据

How do I overcome above error?我如何克服上述错误?

Before installing any packages with the npm install command, you have to have a package.json.在使用 npm install 命令安装任何包之前,你必须有一个 package.json。 Use this in the folder在文件夹中使用这个

npm init

Now, you can install packages.现在,您可以安装软件包。

and welcome to NodeJS.欢迎使用 NodeJS。 Hope this little issue hasn't deterred you, and hopefully by now you have overcome this challenge and moved on your NodeJS journey.希望这个小问题没有让你望而却步,希望你现在已经克服了这个挑战并开始了你的 NodeJS 之旅。 But in spirit of sharing knowledge, here is what had happened.但本着分享知识的精神,这就是发生的事情。

As your npm install script indicated, you have not provided description and repository fields, and you don't have a README.md file .正如您的npm install脚本所示,您没有提供descriptionrepository字段,并且您没有README.md文件

The easiest way to create a new package.json is to run the npm init command .创建新package.json的最简单方法是运行npm init command

npm init --yes npm init --yes

Here is a sample package.json file to get you started.这是一个示例 package.json 文件,可帮助您入门。 Best of luck!!祝你好运!!

  {
    "name": "my_package",
    "description": "Awesome NodeJS project.",
    "version": "1.0.0",
    "main": "index.js",
    "scripts": {
      "test": "echo \"Error: no test specified\" && exit 1"
    },
    "repository": {
      "type": "git",
      "url": "https://github.com/ashleygwilliams/my_package.git"
    },
    "keywords": [],
    "author": "",
    "license": "ISC",
    "bugs": {
      "url": "https://github.com/ashleygwilliams/my_package/issues"
    },
    "homepage": "https://github.com/ashleygwilliams/my_package"
  }

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM