【问题标题】:I can't install gulp-typescript in my project我无法在我的项目中安装 gulp-typescript
【发布时间】:2017-10-10 03:04:33
【问题描述】:

我在全局和本地安装了 typescriptgulp-typescript,甚至我在 package.json 中的 devDependencies 也有"gulp-typescript": "^3.1.6" 但是当我在 cmd 中写 gulp tsc 时,它说:typescript is not installed - install with 'npm install typescript --save-dev'

运行 gulp 后的屏幕截图:

npm install typescript --save-dev之后的截图:

【问题讨论】:

  • 你能出示你的package.json吗?
  • @AlekseyL { "name": "typescript", "version": "1.0.0", "description": "", "main": "gulpfiles.js", "dependencies": { "gulp": "^3.9.1", "gulp-util": "^3.0.8" }, "devDependencies": { "gulp": "^3.9.1", "gulp-typescript": "^3.1.6", "gulp-util": "^3.0.8" }, "scripts": { "test": "echo \"Error: no test specified\" && exit 1" }, "author": "Arman Shojaei", "license": "ISC" }
  • 只需将"name": "typescript" 更改为其他内容,例如"name": "typescript-test" 并运行 npm install。您不能将包命名为其依赖项之一。
  • @AlekseyL 非常感谢

标签: typescript gulp gulp-typescript


【解决方案1】:

问题是您的软件包名称typescript 与您尝试安装的软件包相同。将 package.json 中的包名称更改为 typescript 以外的名称:

{
  "name": "typescript-something"
  // ...
}

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 2016-10-15
    • 1970-01-01
    • 2016-01-10
    • 2017-11-26
    • 2020-11-22
    • 1970-01-01
    • 2021-01-02
    相关资源
    最近更新 更多