【发布时间】:2017-10-29 05:10:30
【问题描述】:
我正在尝试运行 ionic cordova build ios 并且一直遇到以下问题:
Error: ./src/app/app.module.ts
Module not found: Error: Can't resolve '@ionic-native/file' in '/Users/justinfrevert/Desktop/AceAdz-App/app-copy/src/app'
resolve '@ionic-native/file' in '/Users/justinfrevert/Desktop/AceAdz-App/app-copy/src/app'
Parsed request is a module
using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./src/app)
resolve as module
looking for modules in /Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules
using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./node_modules)
using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./node_modules/@ionic-native/file)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file.json doesn't exist
as directory
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file doesn't exist
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file.ts]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file.js]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file.json]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/file]
@ ./src/app/app.module.ts 23:0-42
@ ./src/app/main.ts,./src/app/app.module.ts
Module not found: Error: Can't resolve '@ionic-native/photo-library' in '/Users/justinfrevert/Desktop/AceAdz-App/app-copy/src/app'
resolve '@ionic-native/photo-library' in '/Users/justinfrevert/Desktop/AceAdz-App/app-copy/src/app'
Parsed request is a module
using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./src/app)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./src/app)
resolve as module
looking for modules in /Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules
using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./node_modules)
using description file: /Users/justinfrevert/Desktop/AceAdz-App/app-copy/package.json (relative path: ./node_modules/@ionic-native/photo-library)
no extension
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library.js doesn't exist
.json
Field 'browser' doesn't contain a valid alias configuration
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library.json doesn't exist
as directory
/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library doesn't exist
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library.ts]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library.js]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library.json]
[/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic-native/photo-library]
@ ./src/app/app.module.ts 28:0-59
@ ./src/app/main.ts
at new BuildError (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic/app-scripts/dist/util/errors.js:16:28)
at callback (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/@ionic/app-scripts/dist/webpack.js:121:28)
at emitRecords.err (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/webpack/lib/Compiler.js:269:13)
at Compiler.emitRecords (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/webpack/lib/Compiler.js:375:38)
at emitAssets.err (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/webpack/lib/Compiler.js:262:10)
at applyPluginsAsyncSeries1.err (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/webpack/lib/Compiler.js:368:12)
at next (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/tapable/lib/Tapable.js:218:11)
at Compiler.compiler.plugin (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/webpack/lib/performance/SizeLimitsPlugin.js:99:4)
at Compiler.applyPluginsAsyncSeries1 (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/tapable/lib/Tapable.js:222:13)
at Compiler.afterEmit (/Users/justinfrevert/Desktop/AceAdz-App/app-copy/node_modules/webpack/lib/Compiler.js:365:9)
代码更改后没有发生这种情况。这在我试图纠正一个单独的错误之后开始发生:编译器抱怨不正确的类型从离子原生地理定位传递到 watchPosition() 方法。这是一个单独的问题,也是由版本更改引起的 - 所以我尝试将版本从最新版本恢复到 3.14.0。这就是导致上述错误的原因。然后我恢复到 3.11.0,因为那是我在它工作时使用的原始版本。我尝试构建,但仍然无法正常工作。然后我切换回最新版本,但仍然出现上述错误。我尝试卸载并重新安装用于地理定位的cordova和npm包,仍然没有骰子。请让我知道我可以做些什么来解决这个问题。
【问题讨论】:
标签: node.js cordova ionic-framework npm