NestJS: Cannot read property "'createObjectLiteralExpression'" of undefined - nestjs

After upgrade to NestJS 8, I got this when run npm run start:dev
Error Cannot read property "'createObjectLiteralExpression'" of undefined
Any idea what went wrong?
[System Information]
OS Version : Linux 5.4
NodeJS Version : v12.19.0
NPM Version : 6.14.8
[Nest CLI]
Nest CLI Version : 8.1.1
[Nest Platform Information]
platform-socket.io version : 8.0.6
platform-express version : 8.0.6
microservices version : 8.0.6
websockets version : 8.0.6
schematics version : 8.0.2
passport version : 8.0.1
schedule version : 1.0.1
swagger version : 5.0.9
typeorm version : 8.0.2
testing version : 8.0.6
common version : 8.0.6
config version : 1.0.1
core version : 8.0.6
jwt version : 8.0.0
cli version : 8.1.1

I found the issue myself. Took me hours. TypeScript need to upgrade to v4+.
This is v4+ feature. Even though I read the NestJS V8 blog carefully, still I missed it.

Related

Getting compileSdkVersion is not specified. Please add it to build.gradle

Getting this error while building apk
A problem occurred configuring project ':app'.
com.android.builder.errors.EvalIssueException: compileSdkVersion is not specified. Please add it to build.gradle
In build.gradle already added
compileSdkVersion cordovaConfig.COMPILE_SDK_VERSION
Also in config.xml file added
Can anyone help me what's the issue
Ionic Info
Ionic:
Ionic CLI : 5.4.16 (C:\Users\anshi\AppData\Roaming\npm\node_modules\ionic)
Ionic Framework : #ionic/angular 5.9.4
#angular-devkit/build-angular : 12.1.4
#angular-devkit/schematics : 12.2.18
#angular/cli : 12.2.18
#ionic/angular-toolkit : 4.0.0
Cordova:
Cordova CLI : 11.0.0
Cordova Platforms : android 11.0.0
Cordova Plugins : cordova-plugin-ionic-keyboard 2.2.0, cordova-plugin-ionic-webview 4.2.1, (and 23 other plugins)
Utility:
cordova-res : 0.15.4
native-run (update available: 1.7.1) : 1.5.0
System:
Android SDK Tools : 26.1.1 (C:\Users\username\AppData\Local\Android\Sdk)
NodeJS : v16.13.0 (C:\Program Files\nodejs\node.exe)
npm : 6.14.18
OS : Windows 10
Install module
npm i #ionic/cordova-builders
Is the file present in your node_modules?
node_modules/#ionic/cordova-builders/package.json
have you added the builders with: ng add #ionic/cordova-builders as per docs? https://www.npmjs.com/package/#ionic/cordova-builders
I don't think this is related to your issue. But the newest version of build tools is 33. cordova-android 11 builds by default for target-SDK-32 I believe. build-tools 26 is for targetSDK-26. I think you should add the newer versions of build tools (or use a lower version of cordova-android)

Running Ionic project using specific Node version

I am trying to run an Ionic project using Node version 14.18.3
I am using Volta to set this version for this one particular project
To do this I ran this command:
volta pin node#14
If I navigate to my project and run node -v then I see 14.18.3
When I try and build my project it fails and gives me an error that indicates that my node version is not 14
If I run ionic info then I see the following output. This shows that my node version is 16.13.1
Question - where is 16.13.1 coming from? How do I get Ionic to run using node 14?
Ionic:
Ionic CLI : 6.18.1 (/Users/chris/.volta/tools/image/packages/#ionic/cli/lib/node_modules/#ionic/cli)
Ionic Framework : ionic-angular 3.9.3
#ionic/app-scripts : 3.2.1
Cordova:
Cordova CLI : 9.0.0 (cordova-lib#9.0.1)
Cordova Platforms : android 9.0.0, ios 5.1.1
Cordova Plugins : cordova-plugin-ionic-keyboard 2.1.3, cordova-plugin-ionic-webview 4.1.0, (and 17 other plugins)
Utility:
cordova-res : 0.15.4
native-run (update available: 1.5.0) : 0.3.0
System:
Android SDK Tools : 26.1.1 (/Users/chris/Library/Android/sdk)
ios-deploy : 1.10.0
ios-sim : 8.0.2
NodeJS : v16.13.1 (/Users/chris/.volta/tools/image/node/16.13.1/bin/node)
npm : 8.2.0
OS : macOS Monterey
Xcode : Xcode 13.2.1 Build version 13C100

How to set default time zone in Nestjs?

I tried below script but it didn't work.
{
"scripts": {
"start": "TZ='UTC' nest start"
}
}
[System Information]
OS Version : Linux 5.4
NodeJS Version : v12.18.3
NPM Version : 6.14.6
[Nest CLI]
Nest CLI Version : 7.4.1
[Nest Platform Information]
platform-express version : 7.0.0
passport version : 7.0.0
typeorm version : 7.1.0
common version : 7.0.0
config version : 0.5.0
core version : 7.0.0
jwt version : 7.0.0
In a REPL, this is working as expected.
TZ=UTC node
> d = new Date()
> d.toLocaleTimeString()
I would assume you need to set your start command as
"start": "TZ=UTC nest start"

ionic package build android FAILED due to TypeError: Cannot read property 'length' of undefined

I just created a demo ionic project by ionic start conference, but when I tried to build the Android package, it tell me that TypeError: Cannot read property 'length' of undefined.
Then I tried to create another demo, ionic start blank, failed again.
ionic serve works all good and here is the information of ionic info
global packages:
#ionic/cli-utils : 1.1.2
Ionic CLI : 3.1.2
local packages:
#ionic/app-scripts : 1.3.7
#ionic/cli-plugin-ionic-angular : 1.3.0
Ionic Framework : ionic-angular 3.3.0
System:
Node : v6.9.5
OS : macOS Sierra
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
Is there any dependency problem?
Use following command to build for android:
ionic cordova build android

ionic error - Could not reserve enough space for 2097152KB

[I am getting error while building the android apk in ionic. It says "Could not reserve enough space for 2097152KB object heap. I tried various option but didnt work out. Please Help"][1]
<img src="https://i.stack.imgur.com/O7Oka.jpg">
I was facing the same problem. For me the solution provided by Roman Ashikhmin worked but I found that you also need following Environment Variable too,
GRADLE_OPTS : -Xmx2048M
along with the
_JAVA_OPTIONS : -Xmx1024M
Note: For _JAVA_OPTIONS I tried going over 1024M to 2048M or even 4096M but those options don't work. You can do 512M & or 1024M. For GRADLE_OPTS gogin over 2048M didn't work either.
I'm on:
Java 32bit jdk-8u141
global packages:
#ionic/cli-utils : 1.5.0
Cordova CLI : 7.0.1
Ionic CLI : 3.5.0
local packages:
#ionic/app-scripts : 1.3.12
#ionic/cli-plugin-cordova : 1.4.1
#ionic/cli-plugin-ionic-angular : 1.3.2
Cordova Platforms : android 6.2.3
Ionic Framework : ionic-angular 2.3.0
System:
Node : v6.11.0
OS : Windows 10
Xcode : not installed
ios-deploy : not installed
ios-sim : not installed
npm : 3.10.10
Try to add a Windows Environment Variable named _JAVA_OPTIONS with value -Xmx512M.
It helped me to resolve the same issue.

Resources