在尝试安装ExcelJ(npm install --save exceljs
)之前,我有一个有效的项目。
此后,我开始收到各种错误,例如Cannot read property ‘Minus’ of undefined
和Cannot find module 'postcss-value-something'
,可以通过npm i
找出丢失的任何部分来解决。
但是,此后,我现在收到TypeError: Object prototype may only be an Object or null: undefined
。
遇到这些问题后,我删除了excelJs,希望可以恢复正常,但是没有这种运气。
完整错误如下:
at setPrototypeOf (<anonymous>)
at Object.__extends (F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\node_modules\tslib\tslib.js:68:9)
at F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:118:17
at F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:325:6
at F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:3:17
at Object.<anonymous> (F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\template.js:9:3)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:21:22
at F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:10:17
at Object.<anonymous> (F:\Honeycomb\Honey\Varroa\node_modules\@angular\compiler-cli\src\ngtsc\indexer\src\transform.js:16:3)
package.json的内容如下:
"dependencies": {
"@agm/core": "^1.1.0",
"@agm/js-marker-clusterer": "^1.0.0-beta.3",
"@angular/animations": "^8.0.0",
"@angular/cdk": "^7.3.6",
"@angular/common": "^8.0.0",
"@angular/compiler": "^8.0.0",
"@angular/core": "^8.0.0",
"@angular/forms": "^8.0.0",
"@angular/http": "^7.2.16",
"@angular/material": "^7.3.6",
"@angular/platform-browser": "^8.0.0",
"@angular/platform-browser-dynamic": "^8.0.0",
"@angular/platform-server": "^8.0.0",
"@angular/router": "^8.0.0",
"@angular/upgrade": "^8.2.14",
"@auth0/angular-jwt": "^2.0.0",
"@types/angular": "^1.6.47",
"angular-calendar": "^0.28.16",
"angular2-text-mask": "8.0.4",
"angular2-toaster": "^8.0.0",
"animate.css": "^3.7.0",
"bootstrap": "^4.1.2",
"brace": "0.11.0",
"chart.js": "^2.7.3",
"codemirror": "5.33.0",
"copy-webpack-plugin": "^4.5.1",
"core-js": "2.5.3",
"dragula": "3.7.2",
"file-saver": "^1.3.8",
"flag-icon-css": "2.9.0",
"font-awesome": "^4.7.0",
"highcharts": "7.0.2",
"highcharts-angular": "2.4.0",
"highcharts-boost": "^0.1.7",
"html2canvas": "^1.0.0-alpha.12",
"intl": "^1.2.5",
"js-marker-clusterer": "^1.0.0",
"jspdf": "^1.5.3",
"lodash": "^4.17.10",
"moment": "^2.20.1",
"ng-mat-select-infinite-scroll": "^2.0.0",
"ng-select": "^1.0.2",
"ng2-ace-editor": "^0.3.9",
"ng2-charts": "1.6.0",
"ng2-completer": "^3.0.0-beta.2",
"ng2-dragula": "1.5.0",
"ng2-file-upload": "1.2.1",
"ng2-select": "^2.0.0",
"ng2-validation": "^4.2.0",
"ngx-bootstrap": "2.0.0-rc.0",
"ngx-loading": "^8.0.0",
"ngx-quill": "^8.1.8",
"normalize.css": "^7.0.0",
"oidc-client": "^1.5.1",
"postcss-value-parser": "^4.1.0",
"primeicons": "4.0.0",
"primeng": "9.1.0",
"raven-js": "^3.26.2",
"rxjs": "6.2.1",
"rxjs-compat": "^6.2.1",
"simple-line-icons": "^2.4.1",
"spinkit": "1.2.5",
"ts-helpers": "1.1.2",
"ts-overlapping-marker-spiderfier": "^1.0.2",
"tslib": "^1.9.0",
"xlsx": "0.13.3",
"zone.js": "^0.9.1"
},
"devDependencies": {
"@angular-devkit/build-angular": "^0.803.24",
"@angular/cli": "^8.3.28",
"@angular/compiler-cli": "^10.0.2",
"@angular/language-service": "^10.0.2",
"@fortawesome/fontawesome-free": "^5.6.1",
"@types/core-js": "^2.5.3",
"@types/file-saver": "0.0.1",
"@types/googlemaps": "3.37.7",
"@types/highcharts": "5.0.36",
"@types/jasmine": "^3.5.11",
"@types/jasminewd2": "2.0.3",
"@types/jquery": "^3.5.0",
"@types/lodash": "^4.14.110",
"@types/luxon": "^1.11.1",
"@types/node": "^14.0.19",
"codelyzer": "^6.0.0",
"jasmine-core": "^3.5.0",
"jasmine-spec-reporter": "^5.0.2",
"jasminewd2": "^2.2.0",
"karma": "^5.1.0",
"karma-chrome-launcher": "^3.1.0",
"karma-cli": "^2.0.0",
"karma-coverage-istanbul-reporter": "1.3.3",
"karma-jasmine": "^3.3.1",
"karma-jasmine-html-reporter": "^1.5.4",
"karma-remap-istanbul": "^0.6.0",
"protractor": "^7.0.0",
"rxjs-tslint": "^0.1.8",
"ts-node": "4.1.0",
"tslint": "^6.1.2",
"typescript": "^3.4.5",
"webpack": "^4.43.0",
"webpack-bundle-analyzer": "^3.1.0"
}
到目前为止,我所读过的所有地方都表明cli /编译器cli出了问题,但我印象中^
表示它在必要时进行了更新,我也曾尝试删除^
如果该版本超出了我项目支持的Angular版本。
ng v
返回以下内容:
Angular CLI: 8.3.28
Node: 10.16.0
OS: win32 x64
Angular: 8.0.0
... animations, common, compiler, core, forms, platform-browser
... platform-browser-dynamic, platform-server, router
Package Version
-----------------------------------------------------------
@angular-devkit/architect 0.803.28
@angular-devkit/build-angular 0.803.28
@angular-devkit/build-optimizer 0.803.28
@angular-devkit/build-webpack 0.803.28
@angular-devkit/core 8.3.28
@angular-devkit/schematics 8.3.28
@angular/cdk 7.3.7
@angular/cli 8.3.28
@angular/compiler-cli 10.0.2
@angular/http 7.2.16
@angular/language-service 10.0.2
@angular/material 7.3.7
@angular/upgrade 8.2.14
@ngtools/webpack 8.3.28
@schematics/angular 8.3.28
@schematics/update 0.803.28
rxjs 6.2.1
typescript 3.9.6
webpack 4.43.0
我怀疑这仍然与编译器/ cli版本甚至打字稿有关,正如我在其他地方看到的那样,但是似乎没有关于应该使用哪个版本的指南。
非常感谢您的协助。
答案 0 :(得分:0)
您的角度软件包版本太不同步了!不知何故,您的compiler-cli位于10.0.2,但是您的http位于7.2.16。那是怎么发生的?无论如何,升级角度的最佳方法是使用ng update @angular/cli
,ng update @angular/core
和ng update @angular/material
。
这会将其更新到版本10,并希望进行适当的迁移。以@angular开头的任何内容都应始终具有相同的主版本。您的情况是将v7与v8和v10混合使用。投入v9,您将拥有一个四重奏。
如果使用cli无法进行更新,则最好使用以下步骤:
src
下的源代码以及您认为值得保存的任何其他文件,例如package.json
,以检查您使用的所有非角度软件包。@angular/cli
升级全局ng -g i @angular/cli@latest
ng new xxx
main.ts
,polyfills.ts
和tsconfig
文件,因为最新的cli cli版本进行了重大更改package.json
此后,请始终使用ng update
升级任何angular模块,因为这还包括必要的代码迁移。
请注意,如果您进行^
,npm update
只会更新已安装软件包的次要版本。了解更多here