npm “错误:此命令在工作区外运行Angular CLI时不可用,“但我在正确的文件夹中

cunj1qz1  于 5个月前  发布在  Angular
关注(0)|答案(1)|浏览(100)

当我启动从github克隆的angular项目,使用命令行ng serve或ng serve -o,我的项目结构是x1c 0d1x时,我得到了这个错误“Error:This command is not available when running the Angular CLI outside a workspace.”



而package.json文件是

{
  "name": "gentelella",
  "version": "2.0-beta2",
  "description": "Gentelella Admin is a free to use Bootstrap admin template",
  "scripts": {
    "test": "echo \"Error: no test specified\" && exit 1"
  },
  "repository": {
    "type": "git",
    "url": "git+https://github.com/puikinsh/gentelella.git"
  },
  "keywords": [
    "css",
    "js",
    "html",
    "template",
    "admin",
    "bootstrap",
    "theme",
    "backend",
    "responsive"
  ],
  "author": "Aigars Silkalns",
  "contributors": [
    "Christian Esperar"
  ],
  "license": "MIT",
  "main": "build/js/custom.min.js",
  "bugs": {
    "url": "https://github.com/puikinsh/gentelella/issues"
  },
  "homepage": "https://github.com/puikinsh/gentelella#readme",
  "devDependencies": {
    "browser-sync": "^2.26.7",
    "gulp": "^4.0.2",
    "gulp-autoprefixer": "^7.0.1",
    "gulp-concat": "^2.6.1",
    "gulp-rename": "^2.0.0",
    "gulp-ruby-sass": "^4.0.0",
    "gulp-uglify": "^3.0.2"
  },
  "dependencies": {
    "gentelella": "^1.4.0"
  }
}

字符串
我试着从github上重新克隆这个项目

eanckbw9

eanckbw91#

有时删除文件会导致angular.json从应用的根目录中消失。您只需替换该文件即可。

相关问题