简体   繁体   English

TypeDoc 找不到模块 typescript

[英]TypeDoc cannot find module typescript

I am new to TypeScript and I got some existing TypeScript project.我是 TypeScript 的新手,我有一些现有的 TypeScript 项目。
For my better understanding of the project, I tried to use TypeDoc.为了更好地理解项目,我尝试使用 TypeDoc。
However, I got following error.但是,我收到以下错误。
I tried to fix this issue following similar question but didnt work.我试图在类似的问题之后解决这个问题,但没有奏效。
Could anyone tell me what could be the approach to solve this problem?谁能告诉我解决这个问题的方法是什么?

internal/modules/cjs/loader.js:1032
  throw err;
  ^

Error: Cannot find module 'typescript'
Require stack:
- /usr/local/lib/node_modules/typedoc/dist/lib/cli.js
- /usr/local/lib/node_modules/typedoc/bin/typedoc
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:1029:15)
    at Function.Module._load (internal/modules/cjs/loader.js:898:27)
    at Module.require (internal/modules/cjs/loader.js:1089:19)
    at require (internal/modules/cjs/helpers.js:73:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/typedoc/dist/lib/cli.js:9:20)
    at Module._compile (internal/modules/cjs/loader.js:1200:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1220:10)
    at Module.load (internal/modules/cjs/loader.js:1049:32)
    at Function.Module._load (internal/modules/cjs/loader.js:937:14)
    at Module.require (internal/modules/cjs/loader.js:1089:19) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    '/usr/local/lib/node_modules/typedoc/dist/lib/cli.js',
    '/usr/local/lib/node_modules/typedoc/bin/typedoc'
  ]
}

package.json . package.json

{
  "name": "project",
  "version": "0.1.0",
  "private": true,
  "scripts": {
    "dev": "next dev",
    "build": "next build",
    "start": "next start"
  },
  "dependencies": {
    "@material-ui/core": "^4.9.9",
    "@material-ui/icons": "^4.9.1",
    "@material-ui/lab": "^4.0.0-alpha.48",
    "axios": "^0.19.2",
    "classnames": "^2.2.6",
    "date-fns": "^2.12.0",
    "gray-matter": "^4.0.2",
    "next": "^9.3.4",
    "prop-types": "^15.7.2",
    "react": "16.13.1",
    "react-dom": "16.13.1",
    "remark": "^12.0.0",
    "remark-html": "^11.0.1",
    "remark-slug": "^6.0.0",
    "swr": "^0.2.3",
    "three": "^0.115.0"
  },
  "devDependencies": {
    "@types/node": "^13.11.0",
    "@typescript-eslint/eslint-plugin": "^2.26.0",
    "@typescript-eslint/parser": "^2.26.0",
    "babel-eslint": "^10.1.0",
    "eslint": "^6.8.0",
    "eslint-config-standard": "^14.1.1",
    "eslint-plugin-import": "^2.20.1",
    "eslint-plugin-node": "^11.0.0",
    "eslint-plugin-promise": "^4.2.1",
    "eslint-plugin-react": "^7.19.0",
    "eslint-plugin-react-hooks": "^2.5.1",
    "eslint-plugin-standard": "^4.0.1",
    "typedoc": "^0.17.7",
    "typescript": "^3.8.3"
  }
}

Try following these steps:尝试按照以下步骤操作:

  1. Uninstall typedoc again through this command: > npm uninstall typedoc通过此命令再次卸载typedoc> npm uninstall typedoc
  2. Execute this command: npm install typedoc --ignoreCompilerErrors --logger none --save-dev .执行这个命令: npm install typedoc --ignoreCompilerErrors --logger none --save-dev
  3. Read this article about the utilization of typedoc .阅读这篇关于typedoc使用的文章。

For anyone who is stuck in this issue, install typescript module by this command.对于遇到此问题的任何人,请通过此命令安装 typescript 模块。

npm install -g typescript

It will help you to get rid of this error它将帮助您摆脱此错误

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

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