我需要针对 Microsoft Windows Azure AD 实施 adal 进行身份验证。我正在使用 angular2 CLI 和angular2-adal。
问题是当我将 AdalService 添加到提供程序时会出现此错误:
Uncaught Error: Cannot find module "adal"
at webpackMissingModule (adal.service.js:20)
at Object.<anonymous> (adal.service.js:20)
at __webpack_require__ (bootstrap dd353fe…:52)
at Object.<anonymous> (services.js:8)
at __webpack_require__ (bootstrap dd353fe…:52)
at Object.<anonymous> (core.js:12)
at __webpack_require__ (bootstrap dd353fe…:52)
at Object.638 (create-users.component.ts:15)
at __webpack_require__ (bootstrap dd353fe…:52)
at Object.647 (header.component.ts:47)
而这个:
client?93b6:80./~/angular2-adal/services/adal.service.js
Module not found: Error: Can't resolve 'adal' in 'D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\angular2-adal\services'
resolve 'adal' in 'D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\angular2-adal\services'
Parsed request is a module
using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\angular2-adal\package.json (relative path: ./services)
Field 'browser' doesn't contain a valid alias configuration
after using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\angular2-adal\package.json (relative path: ./services)
resolve as module
looking for modules in D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src
using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\package.json (relative path: ./src)
Field 'browser' doesn't contain a valid alias configuration
after using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\package.json (relative path: ./src)
using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\package.json (relative path: ./src/adal)
as directory
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal doesn't exist
no extension
Field 'browser' doesn't contain a valid alias configuration
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal.js doesn't exist
looking for modules in D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules
using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\package.json (relative path: ./node_modules)
Field 'browser' doesn't contain a valid alias configuration
after using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\package.json (relative path: ./node_modules)
using description file: D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\package.json (relative path: ./node_modules/adal)
as directory
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal doesn't exist
no extension
Field 'browser' doesn't contain a valid alias configuration
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal doesn't exist
.ts
Field 'browser' doesn't contain a valid alias configuration
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal.ts doesn't exist
.js
Field 'browser' doesn't contain a valid alias configuration
D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal.js doesn't exist
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal.ts]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\src\adal.js]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal.ts]
[D:\Git\SistecreditoTutoriales\SistecreditoTutoriales\src\TutorialesWeb\node_modules\adal.js]
@ ./~/angular2-adal/services/adal.service.js 20:14-29
@ ./~/angular2-adal/services.js
@ ./~/angular2-adal/core.js
@ ./src/app/app.module.ts
@ ./src/app/index.ts
@ ./src/main.ts
@ multi main
我一直在寻找可能的解决方案,但少数答案没有好的结果。