我正在尝试构建Cordova应用程序,启动gulp
时出现以下问题:
ReferenceError: primordials is not defined
at fs.js:47:5
at req_ (/home/ubuntu/WebstormProjects/Edilapp/node_modules/natives/index.js:143:24)
at Object.req [as require] (/home/ubuntu/WebstormProjects/Edilapp/node_modules/natives/index.js:55:10)
at Object.<anonymous> (/home/ubuntu/WebstormProjects/Edilapp/node_modules/vinyl-fs/node_modules/graceful-fs/fs.js:1:37)
at Module._compile (node:internal/modules/cjs/loader:1120:14)
at Module._extensions..js (node:internal/modules/cjs/loader:1174:10)
at Module.load (node:internal/modules/cjs/loader:998:32)
at Module._load (node:internal/modules/cjs/loader:839:12)
at Module.require (node:internal/modules/cjs/loader:1022:19)
at require (node:internal/modules/cjs/helpers:102:18)
在我的项目中,我希望有版本4.2.10,实际上我的package.json包含以下内容:此外,如果我浏览node_modules/graceful-fs
文件夹,我实际上找到了一个参考v4更改的自述文件,iidoEe.我有预期的版本。
尽管如此,在package-lock.json文件中,我看到natives@1.1.6被包含在内,并且它提到应该使用graceful-fs@4.x的版本。类似地,在dependencies
部分,我发现glob需要"graceful-fs": "~1.2.0"
并且得到1.2.3,gulp-cssmin需要~2.0.0并且得到2.0.3,vinyl-fs需要~3.0.0并且得到3.0.12。
这是我的全套
{
"name": "xxxxxxx",
"version": "3.0",
"devDependencies": {
"gulp": "^3.9.1",
"gulp-angular-filesort": "^1.2.1",
"gulp-angular-templatecache": "^1.2.1",
"gulp-concat": "^2.3.4",
"gulp-connect": "^5.6.1",
"gulp-cssmin": "^0.1.6",
"gulp-ignore": "^2.0.2",
"gulp-less": "^4.0.1",
"gulp-mobilizer": "^0.0.2",
"gulp-ng-annotate": "^0.2.0",
"gulp-open": "^3.0.1",
"gulp-order": "^1.1.1",
"gulp-rename": "^1.4.0",
"gulp-replace": "^0.4.0",
"gulp-rimraf": "^0.1.0",
"gulp-sequence": "^0.4.6",
"gulp-sourcemaps": "^1.12.1",
"gulp-uglify": "1.5.1",
"streamqueue": "^0.1.1",
"weinre": "^2.0.0-pre-I0Z7U9OV"
},
"cordova": {
"plugins": {
"cordova-plugin-device": {},
"cordova-plugin-inappbrowser": {},
"cordova-plugin-whitelist": {},
"cordova-plugin-file-opener2": {
"ANDROID_SUPPORT_V4_VERSION": "27.+"
},
"cordova-plugin-camera": {},
"cordova-plugin-email-composer": {},
"cordova-plugin-media-capture": {
"CAMERA_USAGE_DESCRIPTION": "Richiesta per invio foto a ente di appartenenza.",
"MICROPHONE_USAGE_DESCRIPTION": "L'app vorrebbe usare il microfono.",
"PHOTOLIBRARY_USAGE_DESCRIPTION": "Richiesta per invio foto a ente di appartenenza."
},
"pushwoosh-cordova-plugin": {
"LOG_LEVEL": "DEBUG",
"IOS_FOREGROUND_ALERT_TYPE": "NONE",
"ANDROID_FOREGROUND_PUSH": "false"
},
"Camera": {},
"cordova-plugin-file-transfer": {},
"cordova-plugin-file": {},
"cordova-plugin-androidx": {},
"cordova-plugin-androidx-adapter": {},
"cordova-plugin-qrscanner": {},
"phonegap-nfc": {},
"org.apache.cordova.geolocation": {},
"cordova-plugin-geolocation": {}
},
"platforms": [
"browser",
"ios",
"android"
]
},
"dependencies": {
"cordova-browser": "^6.0.0",
"cordova-plugin-camera": "^6.0.0",
"cordova-plugin-compat": "^1.2.0",
"cordova-plugin-device": "^2.1.0",
"cordova-plugin-email-composer": "^0.10.1",
"cordova-plugin-file": "^7.0.0",
"cordova-plugin-file-opener2": "^3.0.5",
"cordova-plugin-file-transfer": "^1.7.1",
"cordova-plugin-geolocation": "^4.1.0",
"cordova-plugin-inappbrowser": "^5.0.0",
"cordova-plugin-media-capture": "^4.0.0",
"cordova-plugin-qrscanner": "^3.0.1",
"cordova-plugin-whitelist": "^1.3.5",
"graceful-fs": "4.2.10",
"phonegap-nfc": "^1.2.0",
"www": "0.0.0"
}
}
节点版本:18.7.0 Npm版本:8.18.0 Gulp客户端版本:2.3.0 Gulp区域设置版本:3.9.1
我该如何继续?
1条答案
按热度按时间kzmpq1sx1#
蛮力解决方案:我删除了所有版本的包json,除了那些受约束的包,然后重新安装了每个依赖项。它起作用了。