[BUG] Unable to build an angular 9.1 universal project with form.io
Environment
Please provide as many details as you can:
-
Hosting type
- [X] Local deployment
-
Formio.js version: 4.7.x
-
Frontend framework: angular-formio 4.7.x in an angular 9.1.4 universal project
-
Browser: N/A
-
Browser version: N/A
I'm putting form.io 4.7.8 in an angular 9.1 universal project and get the following after running ngcc or 'npm run build:ssr' or 'npm run dev:ssr'
Error: Error on worker #1: Error: Invariant violated: No format-path or format for <project path>/node_modules/angular-formio/auth : main (formatPath: formio-manager.umd.js | format: undefined)
In node_modules/angular-formio/auth/package.json on line 19, main is set to:
"main": "formio-manager.umd.js",
Should this be set to the following instead?
"main": "formio-auth.umd.js",
To re-create the problem,
- Create an empty angular 9.1 project
- Add angular universal project
- Add angular-formio 4.7.3
- Compile the project with 'npm run build:ssr'
Eventually, I got the project to compile with Ivy enabled by creating an ngcc.config.js file and putting the following:
module.exports = {
packages: {
"angular-formio": {
entryPoints: {
".": {
override: {
main: undefined
}
},
"auth": {
override: {
main: undefined
}
},
"manager": {
override: {
main: undefined
}
},
"grid": {
override: {
main: undefined
}
},
"resource": {
override: {
main: undefined
}
}
}
}
}
}
In spite of the following errors, the project was able to run:
Error: Failed to compile entry-point formio-manager (module as esm5) due to compilation errors:
node_modules/angular-formio/formio.module.js:16:5 - error NG6002: Appears in the NgModule.imports of FormioAuth, but could not be resolved to an NgModule class.
Is it missing an @NgModule annotation?
16 var FormioModule = /** @class */ (function () {
~~~~~~~~~~~~
Compiling formio-grid : module as esm5
Compiling formio-resource : module as esm5
Error: Failed to compile entry-point formio-grid (module as esm5) due to compilation errors:
node_modules/angular-formio/formio.module.js:16:5 - error NG6002: Appears in the NgModule.imports of FormioGrid, but could not be resolved to an NgModule class.
Is it missing an @NgModule annotation?
16 var FormioModule = /** @class */ (function () {
~~~~~~~~~~~~
Error: Failed to compile entry-point formio-resource (module as esm5) due to compilation errors:
node_modules/angular-formio/formio.module.js:16:5 - error NG6002: Appears in the NgModule.imports of FormioGrid, but could not be resolved to an NgModule class.
Is it missing an @NgModule annotation?
16 var FormioModule = /** @class */ (function () {
~~~~~~~~~~~~
node_modules/angular-formio/formio.module.js:16:5 - error NG6002: Appears in the NgModule.imports of FormioResource, but could not be resolved to an NgModule class.
Is it missing an @NgModule annotation?
16 var FormioModule = /** @class */ (function () {
~~~~~~~~~~~~
node_modules/angular-formio/grid/grid.module.js:21:5 - error NG6002: Appears in the NgModule.imports of FormioResource, but itself has errors
21 var FormioGrid = /** @class */ (function () {
~~~~~~~~~~
Related: #441
I don't think that this is related to angular-formio.
I just ran into the same problem except this time it was not for angular-formio but aws-amplify-angular.
I copied the same fix as above for aws-amplify-angular and it worked:
Added ngcc.conf.js:
packages: {
"aws-amplify-angular": {
entryPoints: {
".": {
override: {
main: undefined
}
},
"auth": {
override: {
main: undefined
}
},
"manager": {
override: {
main: undefined
}
},
"grid": {
override: {
main: undefined
}
},
"resource": {
override: {
main: undefined
}
}
}
}
}
}```
Another guy experienced the same problem with Angular here for another 3rd party library: https://tech.wayne-chu.com/archives/24091
Same problem for me, but i'm not using SSR.
i have this dependencies
"@angular/animations": "~10.1.2", "@angular/common": "~10.1.2", "@angular/compiler": "~10.1.2", "@angular/core": "^10.2.4", "@angular/elements": "^11.2.0", "@angular/forms": "~10.1.2", "@angular/platform-browser": "~10.1.2", "@angular/platform-browser-dynamic": "~10.1.2", "@angular/router": "~10.1.2", "@ngx-translate/core": "^13.0.0", "@ngx-translate/http-loader": "^6.0.0", "angular-formio": "^4.11.4",
When run yarn run ngcc some warnings an finaly an error is showed:
$ ..\front\node_modules.bin\ngcc
Warning: Entry point 'angular-formio' contains deep imports into 'D:/dev/Santander/front/node_modules/formiojs/utils/Evaluator'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Warning: Entry point 'formio-manager' contains deep imports into 'D:/dev/Santander/front/node_modules/formiojs/utils/Evaluator'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Warning: Entry point 'formio-grid' contains deep imports into 'D:/dev/Santander/front/node_modules/formiojs/utils/Evaluator'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Warning: Entry point 'formio-resource' contains deep imports into 'D:/dev/Santander/front/node_modules/formiojs/utils/Evaluator'. This is probably not a problem, but may cause the compilation of entry points to be out of order.
Compiling formio-grid : main as umd
Error: Error on worker #4: Error: Invariant violated: No format-path or format for D:/dev/Santander/front/node_modules/angular-formio/auth : main (formatPath: formio-manager.umd.js | format: undefined)
at ..\front\node_modules@angular\compiler-cli\ngcc\src\execution\create_compile_function.js:47:27
at ..\front\node_modules@angular\compiler-cli\ngcc\src\execution\cluster\worker.js:85:54
at step (..\front\node_modules\tslib\tslib.js:143:27)
at Object.next (..\front\node_modules\tslib\tslib.js:124:57)
at ..\front\node_modules\tslib\tslib.js:117:75
at new Promise (
Any idea to solution this?
did anyone find the solution to this?
few package.json dependencies that i think cause the error:
"@agm/core": "^1.1.0",
"@angular/cdk": "^11.0.3",
"@angular/common": "^11.0.7",
"@angular/compiler": "^11.0.7",
"@angular/core": "^11.0.7",
"@angular/elements": "^11.0.5",
"@aws-amplify/ui-angular": "1.0.6",
"@formio/angular": "^5.0.0",
"angular-formio": "^4.11.5",
"formiojs": "^4.14.0-rc.26",
**
ERROR MESSAGE:
**
[31mError:[0m Failed to compile entry-point formio-manager (main as unknown format) due to property main pointing to a missing or empty file: formio-manager.umd.js
Compiling formio-grid : main as umd
Compiling formio-resource : main as umd
Error: Error on worker #1: Error: Failed to find exported name of node (ParseHtmlContentPipe = /** @class / (function () {
function ParseHtmlContentPipe() {
}
/
Some messages that are come from formiojs have hex codes. So the main aim of this pipe is transform this messages to html.
And then render in template.
/
/
Some messages that are come from formiojs have hex codes. So the main aim of this pipe is transform this messages to html.
And then render in template.
/
/*
* @param {?} content
* @return {?}
/
ParseHtmlContentPipe.prototype.transform = /
Some messages that are come from formiojs have hex codes. So the main aim of this pipe is transform this messages to html.
And then render in template.
/
/*
* @param {?} content
* @return {?}
/
function (content) {
/* @type {?} */
var parsedContent = new DOMParser().parseFromString(content, 'text/html').body.childNodes[0];
return parsedContent.textContent;
};
ParseHtmlContentPipe.decorators = [
{ type: core.Pipe, args: [{ name: 'parseHtmlContent', pure: false },] },
];
return ParseHtmlContentPipe;
}())) in '/usr/local/[path to dir here]/node_modules/angular-formio/angular-formio.umd.js'.
I don't think that this is related to
angular-formio. I just ran into the same problem except this time it was not forangular-formiobutaws-amplify-angular.I copied the same fix as above for
aws-amplify-angularand it worked:Added
ngcc.conf.js:packages: { "aws-amplify-angular": { entryPoints: { ".": { override: { main: undefined } }, "auth": { override: { main: undefined } }, "manager": { override: { main: undefined } }, "grid": { override: { main: undefined } }, "resource": { override: { main: undefined } } } } } }```
hi I had the same problem the file you shared didn't worked as it threw error. Can you share steps on how you added this file and exact contents ?
We're currently addressing a backlog of GitHub issues, and as part of this effort, some inactive issues may be marked as closed. This isn't a dismissal, but a step toward more efficient tracking.
If you feel the issue is still relevant, please re-open and we'll ensure it gets the attention it deserves. Your understanding is appreciated as we work to enhance our open-source responsiveness.