简体   繁体   English

npm安装突然失败

[英]npm install suddenly fails

I have been able to install node modules locally in a project for quite some time. 我已经可以在项目中本地安装节点模块了一段时间了。 All of sudden ALL attempts at installation fail, with the same type of error: 所有突然的ALL安装尝试均失败,并出现相同类型的错误:

Homers-MacBook-Pro:test homer$ npm install bootstrap@3
/Users/homer
└── bootstrap@3.3.7 

npm WARN enoent ENOENT: no such file or directory, open '/Users/homer/package.json'
npm WARN homer No description
npm WARN homer No repository field.
npm WARN homer No README data
npm WARN homer No license field.                     

I'm not using a package.json file, just hoping to install some modules in a local node-modules directory. 我不使用package.json文件,只是希望在本地node-modules目录中安装一些模块。 I don't understand why npm suddenly thinks it needs a package,json in my Home directory. 我不明白为什么npm突然认为我的主目录中需要一个package,json

I'm on MacOS 10.12.4. 我在MacOS 10.12.4上。 There have been no upgrades in the system or in Node since the last successful npm install a couple of weeks ago. 自从几周前成功安装npm以来,系统或Node中没有任何升级。

This is just a warning , not error which means you can ignore it. 这只是warning ,不是error ,这意味着您可以忽略它。 And your package has been successfully installed. 并且您的软件包已成功安装。

npm WARN homer No description          // no description in package.json
npm WARN homer No repository field.    // no repository setted in package.json
npm WARN homer No README data          // no introcude md found
npm WARN homer No license field.       // no lisence type setted in package.json

Above warn messages is all about details of package.json which were caused by package.json not found. 上面的warn消息都是关于package.json详细信息的,这些细节是由未找到package.json引起的。


package.json is a config file which stores libraries that you installed by npm . package.json是一个配置文件,用于存储您由npm安装的库。 So that you don't have to copy/manage these libraries manually and locally. 这样您就不必手动和本地复制/管理这些库。

Next time for a new environment, you can simply reprocude the denpendencies by npm install , and npm will read your package.json and reinstall packages stored in it. 下次在新环境中,您可以通过npm install来简化开销,并且npm将读取package.json并重新安装其中存储的软件包。


As commented by @peteb (thanks again), while install packages via npm install [packages] , npm will try to check whether your newly installed package is listed in package.json . 如@peteb所评论(再次感谢),当通过npm install [packages]npm将尝试检查您新安装的软件包是否在package.json列出。 If the file doesn't exist, then this warn message will be shown. 如果文件不存在,则会显示此warn message

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

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