我正在尝试编译一个已经构建的Angular 应用程序。升级到最新版本是不可能的,但已经构建的应用程序应该只是编译好。
我package.config文件是
{
"name": "my name",
"version": "1.0.0",
"description": "what does this do?",
"license": "MIT",
"scripts": {
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"dependencies": {
"@angular/animations": "^5.2.10",
"@angular/common": "^5.2.10",
"@angular/compiler": "^5.2.10",
"@angular/compiler-cli": "^5.2.10",
"@angular/core": "^5.2.10",
"@angular/forms": "^5.2.10",
"@angular/http": "^5.2.10",
"@angular/platform-browser": "^5.2.10",
"@angular/platform-browser-dynamic": "^5.2.10",
"@angular/platform-server": "^5.2.10",
"@angular/router": "^5.2.10",
"angular2-focus": "^1.1.0",
"bootstrap": "^3.3.7",
"chart.js": "^2.7.2",
"classlist.js": "^1.1.20150312",
"core-js": "^2.4.1",
"file-saver": "^1.3.3",
"font-awesome": "^4.7.0",
"fullcalendar": "^3.2.0",
"fullcalendar-scheduler": "^1.5.1",
"jquery": "^3.1.1",
"moment": "^2.18.1",
"primeng": "^5.2.4",
"rxjs": "^5.2.0",
"typescript": "^2.8.1",
"web-animations-js": "^2.2.2",
"zone.js": "^0.8.5"
},
"devDependencies": {
"@angular/cli": "^1.6.6",
"@angular/compiler-cli": "^5.2.10",
"@types/core-js": "^0.9.34",
"@types/jasmine": "^2.5.35",
"@types/jquery": "^2.0.34",
"@types/lodash": "^4.14.40",
"@types/moment": "^2.13.0",
"@types/node": "^6.0.45",
"@types/q": "0.0.32",
"@types/selenium-webdriver": "^2.53.32",
"codelyzer": "^4.2.1",
"jasmine-core": "~2.5.2",
"jasmine-spec-reporter": "~3.2.0",
"karma": "~1.4.1",
"karma-chrome-launcher": "~2.0.0",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^0.2.0",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"lodash": "^4.16.2",
"primeng": "^4.0.1",
"protractor": "~5.1.0",
"ts-node": "~2.0.0",
"tslint": "~5.9.1",
"typescript": "^2.8.1"
}
}
运行ng build时出现此错误
您的全局Angular CLI版本(14.0.0)高于本地版本(1.6.6)。将使用本地Angular CLI版本。
要禁用此警告,请使用"ng config-g cli. warnings. versionMismatch false"。
@angular/compiler-cli@5. 2. 11需要typescript@'〉= 2.4.2〈2.7.0 ',但找到却是2.9.2使用此版本可能导致未定义行为,并且难以调试问题
请运行以下命令以安装兼容版本的TypeScript。
npm install typescript@'>=2.4.2 <2.7.0'
要禁用此警告,请运行"ng set warnings. typescriptMismatch = false"。
日期:2022年11月23日02:55:08.478
Hash: 9743454dc3930ee3a8f6 Time: 4325ms chunk {inline} inline.bundle.js, inline.bundle.js.map (inline) 5.83 kB [entry] [rendered] chunk {main} main.bundle.js, main.bundle.js.map (main) 303 bytes [initial] [rendered] chunk {polyfills} polyfills.bundle.js, polyfills.bundle.js.map (polyfills) 323 bytes [initial] [rendered] chunk {scripts} scripts.bundle.js, scripts.bundle.js.map (scripts) 675 kB [initial] [rendered] chunk {styles} styles.bundle.js, styles.bundle.js.map (styles) 588 kB [initial] [rendered]
在src/app/nets/nets-配置/配置-视图/配置-视图.组件. ts(12,23)中出现错误:错误TS2307:无法找到模块'txtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxtxt
我的Angular 和节点安装
npm i显示此错误
npm i--force有一些警告
我可以看到node_modules中的软件包文件夹
我已删除node_modules文件夹并重试,但出现此错误
指令集
2条答案
按热度按时间nom7f22z1#
看起来你还没有在你的根文件夹上安装npm,因为它抛出了它找不到模块'primeng',这是在package.json
设法
xzlaal3s2#
您必须删除node_modules文件夹和package-lock文件,然后运行npm i,它将工作。谢谢