Curcuma_
Curcuma_

Reputation: 901

package.json erroneous syntax

I am experiencing Openshft cloud platform. When I added a dependency from a local NodeJs project another dependency, which figures in a named package-lock.json file, which is accepts:

{
  "name": "nodejs-ex",
  "version": "0.0.1",
  "description": "Node.js sample app for OpenShift 3",
  "main": "server.js",
  "dependencies": {
    "chai": "^3.5.0",
    "chai-http": "^2.0.1",
    "ejs": "^2.4.1",
    "mocha": "^2.4.5",
    "mongodb": "^2.1.16",
    "morgan": "^1.7.0",
    "object-assign":"4.1.0",
    "accepts": {
      "version": "1.3.7",
      "resolved": "https://registry.npmjs.org/accepts/-/accepts-1.3.7.tgz",
      "integrity": "sha512-Il80Qs2WjYlJIBNzNkK6KYqlVMTbZLXgHx2oT0pU/fjRHyEp+PEfEPY0R3WCwAGVOtauxh1hOxNgIf5bv7dQpA==",
      "requires": {
        "mime-types": "~2.1.24",
        "negotiator": "0.6.2"
      }
    }

vscode complains about syntax of the package.json file returning: Incorrect type. Expected "string". accepts is the additional dependency. What could be wrong ?

Upvotes: 2

Views: 2334

Answers (1)

VtoCorleone
VtoCorleone

Reputation: 17203

The dependency object/value must be a key and then a string. You are trying to set an object to a string value.

https://docs.npmjs.com/files/package.json#dependencies

The version range is a string which has one or more space-separated descriptors

Upvotes: 2

Related Questions