Currently I am working with a legacy angular mixed asp.net core 2.2 web project. It is not a pure angular template structure, the previous programmer modify the project structure so let angular component web page work together with asp.net cshtml page,MVC C# controller. So he can reused his previously asp.net C# code(get data from backend jbase database) from another old project. which is not recommend way to do angular. But that is the way he did that.
We currently need to upgrade this project's angular version from 7.2.1 to latest version. as we need to add new feature in this project.
But we got some issue.
As the project structure changed ,not pure angular
we can not just follow google angular upgrade guide https://update.angular.io/?v=7.2-8.0 to upgrade
For example from version 7.21. to version 8
if I do this command ng update #angular/cli#8 #angular/core#8
Below highlight part still stuck in version 7.2.1 , will not updated automatically in package.json
please see picture 1
https://drive.google.com/file/d/1E7LDdwv724mP9WVBrfJVKLO7LAW1C4EW/view?usp=sharing
I have to manually to do below commands to update each individual angular library one by one
npm install --save #angular/animations#8
npm install --save #angular/cdk#8
npm install --save #angular/common#8
npm install --save #angular/compiler#8
npm install --save #angular/core#8
npm install --save #angular/forms#8
npm install --save #angular/material#8
npm install --save #angular/platform-browser#8
npm install --save #angular/platform-browser-dynamic#8
npm install --save #angular/router#8
After I did above commands, please see below image, the highlighted part updated to version 8
Please see picture 2
https://drive.google.com/file/d/1tN0NVqky0rvuXR45blNmjpBwSeVHnyzJ/view?usp=sharing
I also noticed when update #angular/marterial fromversion 7.2 to version 8.0
Writing way of #angular/marterial import part need to change.
Instead of importing from #angular/material, you should import deeply from the specific component. E.g. #angular/material/button. ng update will do this automatically for you.
for example.
when in #angular/material 7.2.1, in the module.ts we import like below
import { MatDialogModule,MatIconModule,MatNativeDateModule,MatProgressSpinnerModule,MatTooltipModule,
MatStepperModule} from '#angular/material';
please see picture 3
https://drive.google.com/file/d/1Nb1S7QzH0B0qcnx-OaOnj9U4jQUB8lRw/view?usp=sharing
after #angular/material version 8, we need to write as below
import {MatDialogModule} from '#angular/material/dialog';
import {MatIconModule} from '#angular/material/icon';
import { MatNativeDateModule } from '#angular/material/core';
import {MatProgressSpinnerModule} from '#angular/material/progress-spinner';
import {MatTooltipModule} from '#angular/material/tooltip';
import {MatStepperModule} from '#angular/material/stepper';
please see picture 4
https://drive.google.com/file/d/13lEL-rkKVvC_CPK_SDYeUOJ6fysEkDkn/view?usp=sharing
I also created another angular8 small sample project with above angular material import writing, work fine in the sample project.
but in our project, after we run the project dotnet run
we got below error, which indicate
at Object.eval (SharedModule.ts:6) //line 6
at eval (SharedModule.ts:90) //line 90
these two lines has issue.
Please see picture 5
https://drive.google.com/file/d/1m8ibzHs6whBnzKAuH000lQKVHHY-q0AD/view?usp=sharing
line 6 is import {MatDialogModule} from '#angular/material/dialog';
please see picture 6
https://drive.google.com/file/d/1i-_By1bDu4mmySiVRS13h2PhwSzUNrPD/view?usp=sharing
line 90 is export class SharedModule {}
please see picture 7
https://drive.google.com/file/d/1htQTNXZd_bcFCk4QxKn0nSRGi1jCLL6s/view?usp=sharing
currently I have not any clue why import #angular/material has that error message.
I have tested below scenario
If I completed deleted every import from #angular/material ,then project can run fine.
but if I just import a single Angular button
import {MatButtonModule} from '#angular/material/button';
then the project failed.
I created simple sample project always work fine.
I deleted node_modules folder, to reinstall npm install, project still has same error.
when I install #angular/ material npm install --save #angular/material#8, no any error show up in terminal .
just in the project,after upgrade from v7.21 to v8 then got above error.
Did you do export at NgModule in app.module.ts
Related
I found an error in sharp.
After that, I found a blog in which they ask to delete sharp from the node module and run sudo npm i.
I have gone through GitHub and write minipass - 2.7.0
After that, I got a new error in
vips/vips8 file not found #include <vips/vips8>
I'm using Ionic with Angular on Macbook
I use commands which is
1.sudo npm install
2.sudo npm i gulp-sass -ES --unsafe-perm=true
3.sudo ionic cordova platform add ios
I very recently ran into a similar issue after making some changes to a project's package.json on my Mac (not an Angular or Cordova project).
I came across this GitHub issue for the sharp package which mentioned you may need to update the globally-installed version of libvips: https://github.com/lovell/sharp/issues/1148
In my case, since I use Homebrew but had not directly installed this package previously, I was able to resolve by running brew install vips and then re-running npm install. Note that it has a lot of dependencies so installation may take some time.
Edit: if that doesn't work, you may need to try a fresh install by removing node_modules, then re-running npm i.
This might be not applicable to everyone, but remove package-lock.json and node_modules directory first and then try npm install again. (I also added the minipass in my package.json, by the way)
In my case, I had encountered the same error, but I could solve it by doing the above.
i am trying to use this package https://github.com/react-native-community/react-native-linear-gradient
For ios i followed these steps;
npm i --save react-native-linear-gradient
react-native link
then i restarted my packager and run react-native run-ios
App works.
Then i import the package like
import RNAccountKit from 'react-native-facebook-account-kit';
Then app fails.
Here is the issue details;
https://github.com/react-native-community/react-native-linear-gradient/issues/323
any ideas ?
Instead of automatic installation try manual installation and try again
I'm trying to build and run an iOS simulator version of the getting started React Native project from the instructions at:
https://facebook.github.io/react-native/docs/getting-started.html
The app launches in the XCode simulator, displays it's window very briefly but then an exception occurs that opens a red screen with the message
"Requiring unknown module "498".If you are sure the module is there,
try restarting Metro Bundler. You may also want to run yarn, or npm
install (depending on your environment).
loadModuleImplementation require.js:176:29
viewPropTypes.js:15:30
loadModuleImplementation require.js:212:12
View.js:20:22
loadModuleImplementation require.js:212:12
AppContainer.js:22:13"
etc
Line 15 of ViewPropTypes is
const PlatformViewPropTypes = require('PlatformViewPropTypes');
Line 20 of node_modules/react_native/Libraries/Components/Views/View.js is
const ViewPropTypes = require('ViewPropTypes');
Note: There is another, 15 line View.js files in the directory structure at node_modules/react_native/lib/ it's basically a stub containing
// This is a forwarding module to allow React to require React Native internals
// as node dependency
module.exports = require('View');
I'm on the latest of everything, MacOS High Sierra (10.13.4), XCode 9.3 with 9.3 command line tools installed. I've tried running yarn and npm install, and a fresh install. Obviously I have NPM and Watchman installed. Any ideas why the stock example won't run for me?
Newbie mistake. I had previously attempted to build a different React Native project in a different directory, and Metro Bundler was still pointed at the previous project. As the error message suggested, restarting Metro Bundler fixed the problem.
Also didn't realize the errors in the exception screen were tappable, they take you right into the Metro Bundler terminal process for more detail. Hope this helps someone else too!
In my case, just close all the related process, and re-run react-native run-android solved the problem.
refer to: https://github.com/facebook/react-native/issues/11568
I had the same issue.
In my case, while creating a reusable component, I wasn't importing React into the file,as I was not using them(in functional component) in the component file.
Turns out that jsx to React Element conversion happens per file/module basis, so we should import React and component in every file.
Including Both React and Component normally, solved the problem.
For me I got "955" error. And a simple solution was to
import React, {Component} from "react";
Here is the problem:
I want to install SafeAreaView to my project to adapt iPhone X screen, and I do not want to upgrade react-native version to 0.50.1 which contains the SafeAreaView component, now my react-native version is 0.48.0, there is also a JS only version that is available as an npm module, react-native-safe-area-view.
https://github.com/react-community/react-native-safe-area-view
I installed it with
npm install react-native-safe-area-view --save
then I run my project with xcode, It shows errors
Here is the errors:
error: bundling failed: ambiguous resolution: module /Users/dongfanggouwu-xiong/WebstormProjects/untitled/index.js tries to require react-native, but there are several files providing this module. You can delete or fix them:
/Users/dongfanggouwu-xiong/WebstormProjects/untitled/node_modules/react-native-safe-area-view/node_modules/react-native/package.json
/Users/dongfanggouwu-xiong/WebstormProjects/untitled/node_modules/react-native/package.json
there are two react-native module, one is in react-native-safe-area-view, and I don't know how to fix it, I have wasted much time on it, and tried a lot ways to find a solution.
So is there anyone who has the same problem about iPhone X adaption in react-native with me?
Finally, I found a solution.
If you’re not on React Native 0.50+ yet, you can use react-navigation’s SafeAreaView.
import { SafeAreaView } from 'react-navigation'
and the react-navigation version must be the newer version which contains SafeAreaView, as far as i know, react-navigation version has to at least 1.00#beta 16, so maybe you need to upgrade your react-natigation to a newer version.
I'm currently trying to learn react Native. While building my first App I tryed to include a external Component from Github (https://github.com/voronianski/react-native-effects-view). Fallowing the small step by step instruction I installed the Component via npm npm install react-native-effects-view --save and included the native Code via XCode:
and required the Component via var EffectsView = require('react-native-effects-view');. After restarting the App I get the fallowing error: Error: Requiring unknown module "react-native-effects-view". If you are sure the module is there, try restarting the packager. (I did restart the package roughly 1000 times)
Maybe somebody can point out the mistake I did and explain me how to do it correct?
Thanks
Daniel
Try to run react-native run-ios. You need to run this after npm install.
you need to bundle your app again since emulator doesn't have the binary for react-native-effects-view module yet
so just run this command again
react-native run-ios