简体   繁体   English

angular 1.6 es6 es5 browserify“未捕获的错误:[$ injector:nomod]模块'appSuite'不可用!”

[英]angular 1.6 es6 es5 browserify “Uncaught Error: [$injector:nomod] Module 'appSuite' is not available!”

I am trying to move an angular 1.6 application from ES5 to ES6. 我正在尝试将一个有角度的1.6应用程序从ES5迁移到ES6。 The index html contains the name of the app: ng-app="appSuite" and we normally reference the individual js files with script tags. 索引html包含应用程序的名称:ng-app =“ appSuite”,我们通常使用脚本标签引用各个js文件。

I've now changed the html to refer to the bundle file which should have all the sources in because I've added imports to the app.module.js .. 现在,我更改了html来引用应该包含所有源的捆绑文件,因为我已经将导入添加到app.module.js中。

We use grunt and I've added babel and browserify steps. 我们使用grunt,我添加了babel和browserify步骤。 The top of the app.module.js now has: app.module.js的顶部现在具有:

"use strict";
export default appSuite;             <<< Is this correct ?
import './access.controller.js';
import './apiClient.service.js';

After Babel it becomes : 巴别塔之后变成:

"use strict";

Object.defineProperty(exports, "__esModule", {
    value: true
});

require('./access.controller.js');

Then the browserify changes it to: 然后,browserify将其更改为:

(function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof 
require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var 
f=new Error("Cannot find module '"+o+"'");throw 
f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o]
[0].call(l.exports,function(e){var n=t[o][1][e];return s(n?
n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof 
require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})
({1:
[function(require,module,exports){
"use strict";

(function () {
"use strict";

angular.module("appSuite").controller("accessController", accessController);

Unfortunately when I run it now gives: 不幸的是,当我运行它时,它给出了:

Uncaught Error: [$injector:nomod] Module 'appSuite' is not available!**

Anyone have an idea what I'm missing here or have a way to debug it ? 任何人都知道我在这里缺少什么或有一种调试方法? Thanks in advance and Happy Holidays ! 在此先感谢您和节日快乐!

You need to have empty dependencies loaded with your module , 您需要在模块中加载空的依赖项,

const appSuite= angular.module('appSuite', [])
export default appSuite

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 角度:未捕获错误:[$ injector:nomod]模块“控制器”不可用! 您拼错了模块名称或忘记了加载它 - Angular: Uncaught Error: [$injector:nomod] Module 'controllers' is not available! You either misspelled the module name or forgot to load it AngularJS:未捕获的错误:[$injector:nomod] 模块 _ 不可用! | 对模块的多次引用 - AngularJS: Uncaught Error: [$injector:nomod] Module _ is not available! | Multiple References to Module 错误:[$ injector:nomod]模块不可用 - Error: [$injector:nomod] Module is not available Angular / Karma:错误:[$ injector:nomod]模块&#39;模块&#39;不可用 - Angular/Karma: Error: [$injector:nomod] Module 'module' is not available Angular js:Uncaught Error:[$ injector:nomod]模块不可用 - Angular js : Uncaught Error: [$injector:nomod] module unavailable Angular JS错误:[$ injector:nomod]模块&#39;portfolioMockupApp.services&#39;不可用 - Angular JS Error: [$injector:nomod] Module 'portfolioMockupApp.services' is not available Angular 1.6 ES6无错误无应用 - Angular 1.6 ES6 No-error no app 角度错误,在npm build [$ injector:nomod]模块&#39;testApp&#39;不可用 - Angular error, in npm build [$injector:nomod] Module 'testApp' is not available 未捕获的错误:[$ injector:modulerr]由于以下原因而无法实例化模块xxApp:错误:[$ injector:nomod]模块&#39;xxApp&#39;不可用 - Uncaught Error: [$injector:modulerr] Failed to instantiate module xxApp due to: Error: [$injector:nomod] Module 'xxApp' is not available 未捕获的错误:[$injector:modulerr] 错误:[$injector:nomod] 模块“chart.js”不可用 - Uncaught Error: [$injector:modulerr] Error: [$injector:nomod] Module 'chart.js' is not available
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM