Cannot find module '#angular/core' after angular-cli update - angularjs

My application was working just well. Until I wanted to use angular-in-memory-web-api which returned undefined.
I thought updating my angular-cli to latest may work. But now I get the 'Cannot find module '#angular/core'.
Here are the steps I used for updating:
Updating angular-cli
To update angular-cli to a new version, you must update both the global package and your project's local package.
Global package:
npm uninstall -g angular-cli
npm cache clean
npm install -g angular-cli#latest
Local project package:
rm -rf node_modules dist tmp
npm install --save-dev angular-cli#latest
ng init

Looks like you deleted the node_modules folder. Try running "npm install" again.

Related

An unexpected error occurred: "https://registry.yarnpkg.com/#tsnpm/uikit/-/uikit-0.7.26.tgz: Request failed \"404 Not Found\"

I've been trying to do yarn install and yarn to a project from work but for some reason it keeps displaying the same message and I can't delete the #tspnm/uikit because it's being used in many places.
The node version is 15.13.0
yarn version 1.22.5
and npm version 7.7.6.
I've tried doing yarn cache clean and then yarn and still the same, I've also tried deleting the yarn.lock file and got the same result.
Remove the legacy react-native-cli
npm uninstall -g react-native-cli
Install new one from "react-native-community":
npm i -g #react-native-community/cli
after that, init the Project with:
npx react-native init MyApp --template react-native-template-typescript

How to convert a project from npm to yarn by default

My project was initialized using npm and for a long time I had been working with npm, now I wanted to switch to yarn, since this solves some problems, the question is how to create-react-app so that by default it offers to update using yarn instead of npm
That is, yes, I can update my packages with yarn, but I would like create-react-app itself to offer an update using yarn
First, you need to have yarn installed in your computer.
Follow instruction on https://classic.yarnpkg.com/en/docs/install
Then, create-react-app will use yarn by default, as explained here:
https://create-react-app.dev/docs/getting-started/#selecting-a-package-manager
Note:
If you are trying to update an already existing app, then delete package-lock.json and node_modules, and install dependencies again with yarn:
rm -rf node_modules
rm package-lock.json
yarn install // will create a new yarn.lock file
Did you try:
yarn create <starter-kit-package> [<args>]
e.g:
$ yarn global add create-react-app
https://classic.yarnpkg.com/en/docs/cli/create/
I just delete npm from my project and leave only yarn localy and its work fine

material-ui: Cannot find module: './AccessAlarm'

We have a project using #material-ui. It's built upon:
create-react-app: 3.4
node: 10.18.1
yarn: 1.21.1
#material-ui: 4.9.x
This problem is weird: i can yarn start and yarn build locally, the versions are exactly the same as server. However, after I push to server, it failed:
[4/4] Building fresh packages...
success Saved 1 new dependency.
info Direct dependencies
└─ #material-ui/icons#4.9.1
info All dependencies
└─ #material-ui/icons#4.9.1
Done in 8.27s.
+ yarn run build:dev
yarn run v1.21.1
$ cp .env.sample .env && react-scripts build
The following changes are being made to your tsconfig.json file:
- compilerOptions.paths must not be set (aliased imports are not supported)
Creating an optimized production build...
Failed to compile.
./node_modules/#material-ui/icons/esm/index.js
Cannot find module: './AccessAlarm'. Make sure this package is installed.
You can install this package by running: yarn add ./AccessAlarm.
The building steps on server is:
node -v
rm yarn.lock
rm -rf build node_modules
yarn install
yarn add #material-ui/core // I have tried to run with and w/o these two lines
yarn add #material-ui/icons
yarn run build:dev
Anyone has any ideas about this? Thanks.
yarn cache clean does the trick.
In my case the error was occuring locally and this is what fixed it:
yarn add #material-ui/core
Then
yarn link
Then
yarn upgrade #material-ui/core
Then
yarn upgrade #material-ui/icons
Then
npm start

How to fix: Npx create-react-app does not install everything only package.json and node modules

I'm trying to create a new react app, but whenever I do npx create-react-app or npm init react-app, only the node_modules and a portion of package.json is installed.
npx create-react-app new-app
(https://imgur.com/iJDVQ3E) -> Current package.json and folder structure
Expected public folder and script run commands in package.json
I know it's been two months, but I came across this exact issue and found the next solution:
You only need to update your npm and node modules, they are outdated for us or missing something important and that is why we get no template folders. Try below command:
run npm install -g update-node
run npm update npm -g
These two commands should fix it, if not, let me know, maybe I forgot one command to tell you.
Uninstall react in case its installed globally by running the command "npm uninstall -g create-react-app". then run "npx install -g create-react-app".
npx comes with npm 52+ updated versions
tried using the above 2 commands and got created all the required folders under react app.
run npm install -g update-node
run npm update npm -g

Reactjs project creating while react-dev-utils not found

I had created reactjs project first I had installed globally create react app
npm install -g create-react-app
next, I try to project creation. am using this command
create-react-app react-firebase
while installing i had faced npm ERR! 404 Not Found: react-dev-utils#^5.0.2
error:
npm ERR! code E404
npm ERR! 404 Not Found: react-dev-utils#^5.0.2
How to fix it...
i tried this yarn add -g react-dev-utils#https://registry.npmjs.org/react-dev-utils/react-dev-utils-5.0.2.tgz (remove the "/-/" from the URL) and then run create-react-app my-app and it worked.
or if using npm try:
npm install -g react-dev-utils#https://registry.npmjs.org/react-dev-utils/react-dev-utils-5.0.2.tgz
The problem is npm is not able to find react-dev-utils in the registry server.
you can try different registries as mentioned here
Can't install any packages in Node.js using "npm install"
then you can solve this installing that package
npm install react-dev-utils#^5.0.2 -g
Something has changed in the registries. Explicitly adding the package didn't work for me, but flushing the lock files to remove reference to the old registry path did:
Yarn:
Delete yarn.lock
Run yarn
NPM:
Delete package-lock.json
Run npm install

Resources