Angular `ng build --prod` issue - angular5

when i did
--> 'ng build --prod'
i got this error
ERROR in : Cannot determine the module for class AppComponent in
E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.component.ts! Add
AppComponent to the NgModule to fix it.
Cannot determine the module for class OfferCreationFinalForwarderComponent
in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-creation-final-
forwarder/offer-creation-final-forwarder.component.ts! Add
OfferCreationFinalForwarderComponent to the NgModule to fix it. Cannot determine the module for class OfferCommonTopComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-common-top/offer-common-top.component.ts! Add OfferCommonTopComponent to the NgModule to fix it. Cannot determine the module for class OfferCommonRightComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/offer-common-right/offer-common-right.component.ts! Add OfferCommonRightComponent to the NgModule to fix it. Cannot determine the module for class TopMenuComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/top-menu/top-menu.component.ts! Add TopMenuComponent to the NgModule to fix it. Cannot determine the module for class BookingCreationComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-creation/booking-creation.component.ts! Add BookingCreationComponent to the NgModule to fix it. Cannot determine the module for class ShipperCommonRightMenuComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/shipper-common-right-menu/shipper-common-right-menu.component.ts! Add ShipperCommonRightMenuComponent to the NgModule to fix it. Cannot determine the module for class BookingShipperCommonTopComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-shipper-common-top/booking-shipper-common-top.component.ts! Add BookingShipperCommonTopComponent to the NgModule to fix it. Cannot determine the module for class JobboardComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/jobboard/jobboard.component.ts! Add JobboardComponent to the NgModule to fix it. Cannot determine the module for class LogInComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/log-in/log-in.component.ts! Add LogInComponent to the NgModule to fix it. Cannot determine the module for class RegistrationComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/registration/registration.component.ts! Add RegistrationComponent to the NgModule to fix it. Cannot determine the module for class TopMenuRegistrationComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/top-menu-registration/top-menu-registration.component.ts! Add TopMenuRegistrationComponent to the NgModule to fix it. Cannot determine the module for class HomeComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/home/home.component.ts! Add HomeComponent to the NgModule to fix it. Cannot determine the module for class DocumentsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/documents/documents.component.ts! Add DocumentsComponent to the NgModule to fix it. Cannot determine the module for class MarketPlaceComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/market-place/market-place.component.ts! Add MarketPlaceComponent to the NgModule to fix it. Cannot determine the module for class ShipperLetterInstructionComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/shipper-letter-instruction/shipper-letter-instruction.component.ts! Add ShipperLetterInstructionComponent to the NgModule to fix it. Cannot determine the module for class AcceptanceComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/acceptance/acceptance.component.ts! Add AcceptanceComponent to the NgModule to fix it. Cannot determine the module for class FinalChargesComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/final-charges/final-charges.component.ts! Add FinalChargesComponent to the NgModule to fix it. Cannot determine the module for class BookingsForwarderComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/bookings-forwarder/bookings-forwarder.component.ts! Add BookingsForwarderComponent to the NgModule to fix it. Cannot determine the module for class IwdatablesComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/iwdatables/iwdatables.component.ts! Add IwdatablesComponent to the NgModule to fix it. Cannot determine the module for class CheckOutComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/check-out/check-out.component.ts! Add CheckOutComponent to the NgModule to fix it. Cannot determine the module for class ShipperConsigneeComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/shipper-consignee/shipper-consignee.component.ts! Add ShipperConsigneeComponent to the NgModule to fix it. Cannot determine the module for class BookingDocumentsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/booking-documents/booking-documents.component.ts! Add BookingDocumentsComponent to the NgModule to fix it. Cannot determine the module for class MyBookingsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/my-bookings/my-bookings.component.ts! Add MyBookingsComponent to the NgModule to fix it. Cannot determine the module for class LocalChargesTablesComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/local-charges-tables/local-charges-tables.component.ts! Add LocalChargesTablesComponent to the NgModule to fix it. Cannot determine the module for class BlockCopyPasteComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/blockcopypaste.directive.ts! Add BlockCopyPasteComponent to the NgModule to fix it. Cannot determine the module for class ClickOutsideDirective in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/clickOutside.directive.ts! Add ClickOutsideDirective to the NgModule to fix it. Cannot determine the module for class OnlyNumber in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/decimal.directive.ts! Add OnlyNumber to the NgModule to fix it. Cannot determine the module for class DocumentsuploadComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/documentsupload/documentsupload.component.ts! Add DocumentsuploadComponent to the NgModule to fix it. Cannot determine the module for class AlloffersComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/alloffers/alloffers.component.ts! Add AlloffersComponent to the NgModule to fix it. Cannot determine the module for class SearchFilterPipe in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/jobboard/searchfilter.pipe.ts! Add SearchFilterPipe to the NgModule to fix it. Cannot determine the module for class MyoffersComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/myoffers/myoffers.component.ts! Add MyoffersComponent to the NgModule to fix it. Cannot determine the module for class AllbookingsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/allbookings/allbookings.component.ts! Add AllbookingsComponent to the NgModule to fix it. Cannot determine the module for class AllpaymentsComponent in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/allpayments/allpayments.component.ts! Add AllpaymentsComponent to the NgModule to fix it. Cannot determine the module for class BlockCopyPasteDirective in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/directives/block-copy-paste.directive.ts! Add BlockCopyPasteDirective to the NgModule to fix it. Cannot determine the module for class AppModule in E:/GitNew/Terminal2/Terminal2/terminal2/src/app/app.module.ts! Add AppModule to the NgModule to fix it.
I have removed node_modules and reinstalled again still same issue..
app.module.ts
#NgModule({
declarations: [
AppComponent,
OfferCreationFinalForwarderComponent,
OfferCommonTopComponent,
OfferCommonRightComponent,
TopMenuComponent,
...........
ref link checkthis

If ng build works fine, here are my points you should consider
1) 'apiBaseUrl' does not exist on type '{ production: boolean; }' - check your environment.prod.ts file. Is it having the apiBaseUrl?
2) While running the prod build on the cli, you may have errors with your components and Angular does not specify that it in particular.
Hope this helps

Related

ng-stripe-checkout module import in angular 9

I have problem with build after upgrading to Angular9. This is the error I get:
ERROR in node_modules/ng-stripe-checkout/src/stripe-checkout.module.d.ts:1:22 - error NG6002: Appears in the NgModule.imports of AppModule, but could not be resolved to an NgModule class
any ideas?

Module not found: Error: Can't resolve 'react-native/Libraries/Image/resolveAssetSource'

I'm adding an audio module in my current react-native project. I have tried installing several modules (react-native-sound, react-native-track-player). Getting in both modules the same Error output, which is always pointing in the 'react-native/Libraries/Image/resolveAssetsource' as module not found.
ERROR in ./node_modules/react-native-track-player/lib/index.js
Module not found: Error: Can't resolve 'react-native/Libraries/Image/resolveAssetsource' in 'D:\workspaces\web\react\blink\node_modules\react-native-track-player\lib'
# ./node_modules/react-native-track-player/lib/index.js 1:401-459
# ./node_modules/react-native-track-player/index.js
# ./components/ui/BlinkAudio/BlinkAudio.web.js
# ./components/ui/BlinkAudio/index.web.js
# ./components/dialogs/ResourceDetails/ResourceDetails.js
# ./components/dialogs/ResourceDetails/index.js
# ./components/panels/catalog/CatalogPanel.js
# ./components/parts/Main/Main.js
# ./components/parts/Main/index.js
# ./index.web.js
This is the current imports in the index file of the audio module react-native-track-player:
import { Platform, AppRegistry, DeviceEventEmitter, NativeEventEmitter, NativeModules } from 'react-native';
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetsource';
I have tried to fix this including 'resolveAssetsource' from the imports of 'react-native' as below:
import {
Platform,
AppRegistry,
DeviceEventEmitter,
NativeEventEmitter,
NativeModules,
resolveAssetsource
} from 'react-native';
But I am not pretty sure if it would be the best way and normally I don't like to touch package node-modules directly.
I also tried to exclude the audio module from webpack loaders with no result.
module: {
loaders: [
{
test: /\.js?$/,
exclude: function (modulePath) {
return (
/node_modules/.test(modulePath) &&
!/node_modules(\\|\/)react-native-track-player/.test(modulePath)
);
},
I wonder if someone could help me to find an answer and if is possible to deal with this react-native issue, as I'm thinking that these audio modules are calling wrongly the resolveAssetsource, or in the other hand, react-native doesn't provide this specific Library for third parties, I don't know.
This seems to be a syntax error issue. There is no file nor module named resolveAssetsource, the module and filename is resolveAssetSource with a capital S.
Try to remove react-native-track-player with yarn remove react-native-track-player and install it again (or delete the entire node_modules directory and run yarn install again) as the source code under react-native-track-player/lib/index.js has it properly without any errors:
import { Platform, AppRegistry, DeviceEventEmitter, NativeEventEmitter, NativeModules } from 'react-native';
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
If you use it elsewhere, you'll have to import it like this:
import resolveAssetSource from 'react-native/Libraries/Image/resolveAssetSource';
But that is not the prefered way to do it, as this method is a member of the RN Image class/component Image.resolveAssetSource(source), so, it's better to just import the Image component and use it like this:
import {
Platform,
AppRegistry,
DeviceEventEmitter,
NativeEventEmitter,
NativeModules,
Image // Add Image import
} from 'react-native';
// and use the function as of Image method
let audioAssetSource = Image.resolveAssetSource(audioSource);
Either way, you'll have the method working and resolve the asset source information.

Intellisense with 3rd part libraries and angular-cli

In a project created with angular2-cli I need to use some 3rd part javascript libraries that should be available in the global javascript scope (for example TWEEN namespace from the tween.js library).
Accordingly to the angular-cli guide to install a js library as global I've installed it with npm and add the library script in the "scripts" array of the angular-cli.json file.
"scripts": [
"../node_modules/tween.js/src/Tween.js"
],
To use the global TWEEN namespace in an angular component I've declared it as a constant variable at the beginning of the file, like the following:
import { Component, OnInit } from '#angular/core';
declare const TWEEN: any;
#Component({
selector: 'app-root',
templateUrl: './app.component.html',
styleUrls: ['./app.component.scss']
})
export class AppComponent implements OnInit {
title = 'app works!';
constructor() { }
ngOnInit() {
let tween = new TWEEN.Tween({x: 0}).to({x: 1}, 2000);
// ..
}
}
This works, but the problem is that I am not getting any intellisense for any of the 3rd part libraries in this way (I am using WebStorm). Is there anything I can do to get intellisense working? Or are there better ways to import 3rd part javascript libraries in an angular 2 workflow?
You are never going to get intellisense this way, given that you are defining TWEEN at the top of your file as "any", hence saying it could be anything (no type, no intellisense).
You should take a look at this post:
https://weblog.west-wind.com/posts/2016/Sep/12/External-JavaScript-dependencies-in-Typescript-and-Angular-2
It's pretty much telling you that you either have typings in the library itself, which come for free when you install it, or just work around not having the typings.
If you are going to be working with libraries that have no typings at all, you might want to consider creating the typings yourself.

Requiring unknown module, can't import a custom component from index.android.js

I'm new to react native so this must be easy:
My (simple) application:
index.android.js
import SearchContainer from './components/SearchContainer.jsx';
AppRegistry.registerComponent('MyFirstApp', () => SearchContainer);
and in components/SearchContainer.jsx:
import React, { Component } from 'react';
export default class SearchContainer extends Component {
....
}
but I'm getting
Requiring unknown module "./components/SearchContainer.jsx".If you are sure the module is there, try restarting the packager or running "npm install".
I've tried a moving the SearchContainer to the same directory as index.android.js and I get the same thing.
Thanks a bunch in advance, friends!
Ok, I found out a way this will work, but I'm not sure what the science behind it is - I guess "jsx" is a take over from React that simply doesn't belong.
I simply changed "jsx" to "js" and it worked.

Unable to resolve class org.gradle.util.TestUtil in Gradle

This error means that class TestUtil is not on the classpath and the compiler can not find it. I came across such error hundred times before and there was missing Jar or wrong written class names, but now I just don't know what is wrong.
In my buildSrc dir I have custom Task and I made test for it:
package com.example.core.tasks;
import spock.lang.Specification
import org.gradle.api.Project
import org.gradle.util.TestUtil
public class GetInfoTaskTest extends Specification {
def "check files"(){
given:
def project = TestUtil.createRootProject()
when:
GetInfoTask getInfo = project.tasks.create("getInfo", GetInfoTask)
then:
getInfo instanceof GetInfoTask.class
}
}
In the build script in the buildSrc dir:
dependencies {
compile localGroovy()
testCompile 'org.spockframework:spock-core:0.7-groovy-1.8'
testCompile gradleApi()
}
Error:
GetInfoTaskTest.groovy: 4: unable to resolve class org.gradle.util.TestUtil
# line 3, column 1.
import org.gradle.util.TestUtil
^
I checked that this TestUtil is not internal. I still don't know why gradle can not find it.
TestUtil is an internal class. You can't use it in your own code.