Skip to content

Error: Cannot parse file package.json with node v12.16.3 npm 6.14.14 #55

@scscgit

Description

@scscgit

Environment:

  • node v12.16.3
  • npm 6.14.14

package.json, for example after creating a project via npx create-nuxt-app remarktest and installing remark-cli@9 (because version 10 of remark-cli causes a different Must use import to load ES Module error):

{
  "name": "remarktest",
  "version": "1.0.0",
  "private": true,
  "scripts": {
    "dev": "nuxt",
    "build": "nuxt build",
    "start": "nuxt start",
    "lint:md": "remark --ext .md,.mdx --ignore-path .gitignore --frail --quiet .",
    "generate": "nuxt generate"
  },
  "dependencies": {
    "core-js": "^3.15.1",
    "nuxt": "^2.15.7"
  },
  "remarkConfig": {
    "plugins": [
      "preset-prettier"
    ]
  },
  "devDependencies": {
    "remark-cli": "^9.0.0",
    "remark-preset-prettier": "^0.4.1"
  }
}

When running npm run lint:md (which can be simplified to remark README.md), the following error is logged:

README.md
  1:1  error  Error: Cannot parse file `package.json`
Error: Expected preset or plugin, not undefined, at `node_modules\remark-preset-prettier\lib\cjs.js`
    at Error (C:\ProjectsExternal\remarktest\node_modules\fault\index.js:29:12)
    at onparse (C:\ProjectsExternal\remarktest\node_modules\unified-engine\lib\find-up.js:152:13)
    at done (C:\ProjectsExternal\remarktest\node_modules\trough\wrap.js:55:16)

× 1 error
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! remarktest@1.0.0 l: `remark README.md`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the remarktest@1.0.0 l script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions