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:
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. I don't understand why npm suddenly thinks it needs a package,json
in my Home directory.
I'm on 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.
This is just a warning
, not error
which means you can ignore it. 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.
package.json is a config file which stores libraries that you installed by 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.
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
. If the file doesn't exist, then this warn message
will be shown.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.