Cannot find module express in Yarn - node.js

I'm trying to build a react app, which is built from the ground up. I use Yarn as my package manager. Whenever I try to run my node server I'm getting the error "Module not found express". which I did install and is a part of my dependencies.
I found out that the module express is being fetched from a node_modules directory instead of the local app directory, is this the issue?
error description
The module is being fetched from here:
"C:/Users/hp/AppData/Local/Microsoft/TypeScript/4.2/node_modules/#types/express/index"
Thanks in advance :)
EDIT
NPM global screenshots

Related

react npm configuration not setting up correct

I try to run npm run-script build on my project after downloading git and node and it says that it cannot find module when the module is there in the folder, package.lock file includes react scripts as well. I am new to react and just starting out if anyone has experiences this issue before how did you manage to solve?
image description

React Error: Cannot find module './common'

I've scoured the internet for an answer to this, and haven't found anything yet that works. I'm new to using React, but my friend asked for help with some CSS so I cloned his React project from github (the React app is successfully online and he can work on it locally). Repo is here: https://github.com/brandonkun5/TrueAlpha
When I ran npm start, it told me I had no module 'react-scripts', so I ran npm install react-scripts
Now, when I run npm start, I get the following message:
internal/modules/cjs/loader.js:638
throw err;
Error: Cannot find module './common'
So far, I've tried:
npm del package.json
npm del node_modules
npm install
Moving the folder into a different location
Searching the code for 'Require ('common')" and 'Require ('./common')
Updating to the last node version
and nothing has worked yet. Any ideas on what could be causing this error?
The file common.js is missing in node_modules/debug/src/common.js. I copied it from another React project of mine and run npm start in the console and then it worked. Try to copy that file from the path above to same path in this project and it should work. Second option is to run "npm install debug" and file will installed and debug folder will be updated.

React Native: Unable to resolve a local module. Exists in Node Modules

I'm working on an app that both has a website (React) and mobile app (React Native). In one repository I have my web, mobile and redux files which is my local module/package (so that they can be shared). I have not had any problems with installing my local package when working on web. However with React Native I am running into issues with the package.
I ran
npm install --save '../store/sagas
Which gave me
Unable to resolve "redux-saga-store/sagas/index.js" from "App.js"
Fair. App.js is where I am calling my rootSaga via
import rootSaga from 'redux-saga-store/sagas/index.js';
Which is identical to how web is calling the same file.
I checked my node_modules and the package and all the expected files are there. I tried
npm list
Which returned (as expected)
redux-saga-store#1.0.0 -> /Users/{myname}/Repos/{repositoryname}/shared/store
I have triple-checked the paths and they are correct.
I tried npm install with the global flag. I went on to nuking my node_modules and package-lock.json so I could try re-installing. I created a brand new react-native app using create-react-native-app which also did not fix the issue. I would really appreciate any suggestions or help

error Couldn't find package "#jest/environment#^24.5.0" required by "#jest/reporters#^24.5.0" on the "npm" registry

I'm completely new to React Native and I'm following Facebook's tutorial at https://facebook.github.io/react-native/docs/getting-started using React Native CLI.
Yesterday, I've created a project successfully. Today, when I create an empty folder and run react-native init AnotherProject I get:
error Couldn't find package "#jest/environment#^24.5.0" required by "#jest/reporters#^24.5.0" on the "npm" registry.
What am I doing wrong? I'm on npm 6.7.0 and node 11.12.0.
Weird. I've ran the exact same command again, and it worked.

Cannot find module 'express' while running nodemon. Throw error, app crashed

I just created a project "project2" using "create new project : express --view=ejs project2" on a directory where I'd previously installed nodemon.
But when I typed "nodemon" on the terminal, the error says:
I installed http-errors too, but the error message persists.
What should I do to resolve this?
Try running npm install inside the project
It worked after I installed express inside project2 using:
npm install express --save
However, there were still more error messages such as:
"Could not find module 'cookie-parser'," which were all resolved by installing all the respective modules.

Resources