I recently installed angular 13 and tried to install @nestjs/ng-universal with
ng add @nestjs/ng-universal
which worked for previous angular versions but I get Package successfully installed then this error:
*An unhandled exception occurred: Package subpath './schematics/utils' is not defined by
"exports" in C:\Users\ADMIN\kiambol\node_modules@nguniversal\express-engine\package.json
See "C:\Users\ADMIN\AppData\Local\Temp\ng-1gySjP\angular-errors.log" for further
details.*
And the full error in the angular-errors.log file is:
[error] Error [ERR_PACKAGE_PATH_NOT_EXPORTED]: Package subpath './schematics/utils' is not defined by "exports" in C:\Users\ADMIN\kiambol\node_modules@nguniversal\express-engine\package.json
at throwExportsNotFound (internal/modules/esm/resolve.js:299:9)
at packageExportsResolve (internal/modules/esm/resolve.js:522:3)
at resolveExports (internal/modules/cjs/loader.js:449:36)
at Function.Module._findPath (internal/modules/cjs/loader.js:489:31)
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:875:27)
at Function.Module._load (internal/modules/cjs/loader.js:745:27)
at Module.require (internal/modules/cjs/loader.js:961:19)
at require (internal/modules/cjs/helpers.js:92:18)
at Object. (C:\Users\ADMIN\kiambol\node_modules@nestjs\ng-universal\schematics\install\index.js:15:17)
at Module._compile (internal/modules/cjs/loader.js:1072:14)
When I look at the angular project files, nothing has changed and the server files is not setup setup. I tried to create different angular projects just to see if my angular project was not select correctly then added ng add @nestjs/ng-universal again and still got the same result.
To test things out I tried installing @nguniversal/express-engine with the ng add command and this installed correctly with no issues and everything was setup correctly.
Did anything change in the installation process; am I doing something wrong; or is Angular 13 not yet supported?
Please help.
AFAIK i think it an error from the @nestjs/ng-universal side.
as a quick & dirty solution start by installing @nguniversal/express-engine
then go to node_modules/@nguniversal/express-engine/package.json and :
"type": "module"exports: "./schematics/utils": {
"types": "./schematics/utils/index.d.ts",
"esm2020": "./schematics/utils/index.js",
"es2020": "./schematics/utils/index.js",
"es2015": "./schematics/utils/index.js",
"node": "./schematics/utils/index.js",
"default": "./schematics/utils/index.js"
}
then ng add @nestjs/ng-universal should work fine and by updating the packages it should revert the changes
With Angular 13, "ng add @nestjs/ng-universal" creates error. Because it uses the latest verison of library, that is 6th version. Intstead you can use "ng add @nestjs/ng-universal@5" and it works perfectly fine.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With