# npm install 因 package.json 配置错误而失败

**URL:** <https://meta.discourse.org/t/npm-install-fails-due-to-package-json-misconfiguration/101193>\
**Category:** Development\
**Created:** [2018 年11 月 3 日 09:31 UTC](https://meta.discourse.org/t/npm-install-fails-due-to-package-json-misconfiguration/101193 "2018-11-03T09:31:37Z")\
**Posts on this page:** 1\
**Showing post:** 1

<div class="post-metadata">

作者： ![kleinfreund](https://avatars.discourse-cdn.com/v4/letter/k/a6a055/32.png) [@kleinfreund](https://meta.discourse.org/u/kleinfreund)\
发布日期： [2018 年11 月 3 日 09:31 UTC](https://meta.discourse.org/t/npm-install-fails-due-to-package-json-misconfiguration/101193/1 "2018-11-03T09:31:37Z")

</div>

Since the commit [Use Yarn to manage dependencies, cleanup unused bootstrap libs (#6436) · discourse/discourse@dc8a16b · GitHub](https://github.com/discourse/discourse/commit/dc8a16b43bf264b9001e3515aaba9dc9d5143228), running `npm install` fails.

Looking at the log file …

```plaintext
880 silly fetchPackageMetaData error for jquery.autoellipsis@git+https://github.com/pvdspek/jquery.autoellipsis.git premature close
881 silly fetchPackageMetaData error for favcount@git+https://github.com/chrishunt/favcount.git premature close
882 silly fetchPackageMetaData error for jquery-resize@git+https://github.com/cowboy/jquery-resize.git premature close

```

… installation fails for dependencies whose version is a git repository instead of a semantic version string. In particular, they fail if in the repostitory, there is no `package.json` file.

Discourse’s dependencies from `package.json`:

```json
"dependencies": {
  "ace-builds": "1.4.1",
  "bootbox": "3.2.0",
  "chart.js": "2.7.2",
  "favcount": "https://github.com/chrishunt/favcount",
  "handlebars": "4.0.5",
  "htmlparser": "https://github.com/tautologistics/node-htmlparser",
  "jquery": "3.3.1",
  "jquery-color": "1.0.0",
  "jquery-resize": "https://github.com/cowboy/jquery-resize/",
  "jquery.autoellipsis": "https://github.com/pvdspek/jquery.autoellipsis",
  "jquery.cookie": "1.4.1",
  "jquery-tags-input": "1.3.5",
  "magnific-popup": "1.1.0",
  "markdown-it": "8.4.1",
  "mousetrap": "https://github.com/discourse/mousetrap#firefox-alt-key",
  "pikaday": "1.7.0",
  "resumablejs": "1.1.0",
  "spectrum-colorpicker": "1.8.0"
}

```

Is `npm install` still supposed to work or is Yarn the only option here?

---

_[View the full topic](https://meta.discourse.org/t/npm-install-fails-due-to-package-json-misconfiguration/101193)._
