У меня проблема с основным приложением ASP. NET, в котором размещено приложение Angular.
работает npm install
работает нормально, однако npm ci
не работает и выдает следующие ошибки:
Ошибка:
npm WARN prepare removing existing node_modules/ before installation
npm WARN lockfile Optional missing: fsevents@2.2.1
npm ERR! Cannot read property 'requires' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! XX\_logs\2020-04-30T13_32_04_555Z-debug.log
Файл журнала отладки:
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'ci'
1 verbose cli ]
2 info using npm@6.13.4
3 info using node@v12.15.0
4 verbose npm-session 92a2c0a95ca42a4b
5 info prepare initializing installer
6 verbose prepare starting workers
7 verbose prepare installation prefix: XX\ClientApps
8 verbose prepare using package-lock.json
9 warn prepare removing existing node_modules/ before installation
10 verbose checkLock verifying package-lock data
11 warn lockfile Optional missing: fsevents@2.2.1
12 verbose teardown shutting down workers.
13 info teardown Done in 0.001s
14 verbose stack TypeError: Cannot read property 'requires' of undefined
14 verbose stack at addChild (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-logical-tree\index.js:128:24)
14 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\npm-logical-tree\index.js:113:5
14 verbose stack at Array.forEach (<anonymous>)
14 verbose stack at lockTree (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-logical-tree\index.js:107:5)
14 verbose stack at C:\Program Files\nodejs\node_modules\npm\node_modules\libcipm\index.js:144:21
15 verbose cwd C:\Repos\HMI4-2\Plugins\CommonPlugins\WebHmiPlugins\WebHmi.App\ClientApps
16 verbose Windows_NT 10.0.18362
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "ci"
18 verbose node v12.15.0
19 verbose npm v6.13.4
20 error Cannot read property 'requires' of undefined
21 verbose exit [ 1, true ]
Я понятия не имею, что с этим делать и почему установка работает, а ci - нет. Может ли кто-нибудь помочь мне выяснить, почему npm ci падает и как я могу решить эту ошибку?
РЕДАКТИРОВАТЬ: fsevents определяется как необязательная зависимость:
"optionalDependencies": {
"fsevents": "2.2.1",
"node-sass": "4.12.0",
"protractor": "5.4.2",
"ts-node": "8.4.1",
"tslint": "5.20.0"
}
Так что я подумал -no-optional
флаг поможет. Я уничтожил node_modules и package-lock. json run npm install -no-optional
и затем npm ci -no-optional
. Помимо множества предупреждений (см. Ниже) при запуске установки, у меня была та же ошибка, что и выше.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: abbrev@1.1.1 (node_modules\@angular\compiler-cli\node_modules\fsevents\node_modules\abbrev):
npm WARN enoent SKIPPING OPTIONAL DEPENDENCY: ENOENT: no such file or directory, rename 'XX\ClientApps\node_modules\@angular\compiler-cli\node_modules\fsevents\node_modules\abbrev' -> 'XX\ClientApps\node_modules\@angular\compiler-cli\node_modules\fsevents\node_modules\.abbrev.DELETE'
EDIT2:
Добавлена следующая запись / вывод:
C:\Users\XX\AppData\Roaming\npm\node_modules\npm\node_modules\npm-logical-tree\index.js
function addChild (dep, tree, allDeps, pkgLock) {
console.log("==============")
tree.addDep(dep)
console.log(dep)
allDeps.set(dep.address, dep)
const addr = dep.address
console.log(addr)
const lockNode = atAddr(pkgLock, addr)
console.log(lockNode)
Object.keys(lockNode.requires || {}).forEach(name => {
const tdepAddr = reqAddr(pkgLock, name, addr)
let tdep = allDeps.get(tdepAddr)
if (!tdep) {
tdep = makeNode(name, tdepAddr, atAddr(pkgLock, tdepAddr))
addChild(tdep, dep, allDeps, pkgLock)
} else {
dep.addDep(tdep)
}
})
}
Результат:
==============
LogicalTree {
name: 'fsevents',
version: undefined,
address: 'fsevents',
optional: false,
dev: false,
bundled: false,
resolved: undefined,
integrity: undefined,
dependencies: Map {},
requiredBy: Set {
LogicalTree {
name: 'XXMYAppName',
version: '0.0.0',
address: '',
optional: false,
dev: false,
bundled: false,
resolved: undefined,
integrity: undefined,
dependencies: [Map],
requiredBy: Set {}
}
}
}
fsevents
undefined
npm ERR! Cannot read property 'requires' of undefined
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XX\AppData\Roaming\npm-cache\_logs\2020-05-05T08_35_18_624Z-debug.log
EDIT3:
Пакеты. json
{
"name": "XX",
"version": "0.0.0",
"scripts": {
"ng": "ng",
"start": "echo Starting... && ng serve",
"build": "ng build",
"build-libs": "ng build core-lib && ng build dialog-lib && ng build services-lib && ng build components-lib",
"build-app-dashboard": "ng build dashboard-app --base-href /dashboard/ --prod",
"build-app-infeed": "ng build infeed-app --base-href /infeed/ --prod",
"build-apps": "npm run build-app-dashboard && npm run build-app-infeed",
"build-all": "npm run build-libs && npm run build-apps",
"test": "ng test",
"lint": "ng lint",
"e2e": "ng e2e"
},
"private": true,
"//": [
"Please use fixed versions instead of prefixing it with ~ or ^ or using 'latest'.",
"Run command `npm outdated` to check whether newer versions are available."
],
"dependencies": {
"@angular/animations": "9.1.4",
"@angular/cdk": "9.2.2",
"@angular/common": "9.1.4",
"@angular/compiler": "9.1.4",
"@angular/core": "9.1.4",
"@angular/flex-layout": "9.0.0-beta.29",
"@angular/forms": "9.1.4",
"@angular/material": "8.2.3",
"@angular/platform-browser": "9.1.4",
"@angular/platform-browser-dynamic": "9.1.4",
"@angular/platform-server": "9.1.4",
"@angular/router": "9.1.4",
"@aspnet/signalr": "1.1.4",
"@nguniversal/module-map-ngfactory-loader": "8.1.1",
"@progress/kendo-angular-common": "1.2.1",
"@progress/kendo-angular-gauges": "3.0.0",
"@progress/kendo-angular-intl": "2.0.0",
"@progress/kendo-angular-l10n": "2.0.1",
"@progress/kendo-drawing": "1.6.0",
"@progress/kendo-theme-default": "4.12.0",
"aspnet-prerendering": "3.0.1",
"bootstrap": "4.3.1",
"core-js": "3.3.3",
"jquery": "3.4.1",
"moment": "2.24.0",
"ngx-moment": "3.5.0",
"oidc-client": "1.9.1",
"popper.js": "1.16.0",
"rxjs": "6.5.3",
"tslib": "1.10.0",
"zone.js": "0.10.2"
},
"devDependencies": {
"@angular-devkit/build-angular": "0.901.4",
"@angular-devkit/build-ng-packagr": "0.901.4",
"@angular-devkit/schematics": "9.1.4",
"@angular/cli": "9.1.4",
"@angular/compiler-cli": "9.1.4",
"@angular/language-service": "9.1.4",
"@types/jasmine": "3.4.4",
"@types/jasminewd2": "2.0.8",
"@types/node": "12.11.1",
"codelyzer": "5.1.2",
"jasmine-core": "3.5.0",
"jasmine-spec-reporter": "4.2.1",
"karma": "4.4.1",
"karma-chrome-launcher": "3.1.0",
"karma-coverage-istanbul-reporter": "2.1.0",
"karma-jasmine": "2.0.1",
"karma-jasmine-html-reporter": "1.4.2",
"ng-packagr": "^9.0.0",
"nl2br-pipe": "1.2.3",
"typescript": "3.8.3"
},
"optionalDependencies": {
"fsevents": "2.2.1",
"node-sass": "4.12.0",
"protractor": "5.4.2",
"ts-node": "8.4.1",
"tslint": "5.20.0"
}
}