Cannot find module 'umi' - umijs

I just start to learn umijs so, when I try to start (npm start ) then it saw error (Cannot find module 'umi')
Cannot find module 'umi'
Require stack:
E:\Umijs\myapp.umirc.ts

Try to install the dependencies first:
$ npm install
Refer to this documentation page to environment setup:
https://umijs.org/docs/getting-started

Related

Error: Cannot find module 'gulp-webserver'

When I running the node.js project with gulp. I'm getting "Error: Cannot find module 'gulp-webserver'". Re-wrote the connection with below but still its same.
$ npm install --save-dev gulp-webserver
Issue was with the existance of the web server.
Solution: Go to gulp location within your solution and use below..Solved!
$ npm install --save-dev gulp-webserver
This would be usefull..enter link description here

can't install module 'merge-descriptors'

I'm new to node.js.
I'm using WebStorm. I work on Windows.
I configured my app to run on node.js and when I try to run it I get this error:"Cannot find module 'merge-descriptors'".
I followed these post trying to solve it: How do I resolve "Cannot find module" error using Node.js?,
module.js:338 throw err in node.js
I ran "del /s /q node_modules" (parallel to "rm -rf node_modules").
Now I'm trying to run "npm install -g" and I'm getting this error:
See screen shot below
I've tried to understand it and to look for information about it in the net to no avail.
Any help will be profoundly appreciated!
I had similar issue installing the module, I tried npm install or npm update but my network would timeout. However what I did is very simple:
npm install merge-descriptors --save
When installing the dependencies for a package you should be using npm install and not using the -g flag.
The g flag, or global is used when installing a package globally, which places them in a direct location that is not accessible by the project.
See https://docs.npmjs.com/files/folders
The specific error you're seeing is that the logged in user doesn't have permission to write to the install directory. This can be overcome with sudo command, ex., sudo npm install. But as others have indicated, if you have to do this then something about your app's configuration could be wrong.

Error: Cannot find module 'pretty-bytes'

I am getting Error: Cannot find module 'pretty-bytes' error on my mac machine when I do yo gulp-angular.
Not able to run gulp serve after getting this error
When you have a Error: Cannot find module it means that you're trying to require a package that is not installed yet.
Open a terminal then cd in your project root. When you're in your projet root you can install the module by executing npm install pretty-bytes.
You should also consider adding it to your package.json file either in the dependencies or the devDependencies.

Error: cannot find module npm-shrinkwrap

Setting up bootstrap with grunt.
Getting the following error:
Cannot find module npm-shrinkwrap
Tried npm install shrinkwrap, still getting the same error.
run npm install first on bower_components\bootstrap directory. Then, run grunt dist.

npm install is missing modules

Before I can run gulp in my project I need to run npm install. This works except on my computer, because I get the following error:
Error: Cannot find module 'socket.io'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
...
I can fix this with
$> npm install socket.io
Now when I do the install command again I get
Error: Cannot find module 'di'
...
When I install di and run the install command again I get:
Error: Cannot find module 'log4js'
I think that this might continue for a very long time. Any suggestions what is going on here and how to fix this ?
I've faced the same problem when bootstrapping a MEAN application and add each missing dependencie with npm install packageName --save was not an option so I came across to npm-install-missing whom has saved my life :)
Installation
npm install -g npm-install-missing
Usage
npm-install-missing
Running npm install will install all dependencies that are specified in the package.json. Seems like you have quite a few dependencies that are not defined that way. Use npm install packageName --save and npm will add the package to your package.json.
I am using the same version of npm/node. Sometimes, it is like npm is "lost". What I suggest is :
rm of your node modules (at least the one that is concerned)
npm cache clean
run "npm install" several times, until all dependencies are resolved and no message are displayed
It seems that gulp need 'karma' dependencies (socket.io ,di ,log4js...) so you will have to run :
npm install karma
so just runing this command solved the problem, and all should be good, the same thing happens with grunt as well for some reasons.
This worked for me. By commenting 3 lines in C:\Program Files\nodejs\node_modules\npm\node_modules\graceful-fs\polyfills.js.
Refer [https://flaviocopes.com/cb-apply-not-a-function/]
// fs.stat = statFix(fs.stat) # Line: 61
// fs.fstat = statFix(fs.fstat) # Line: 62
// fs.lstat = statFix(fs.lstat) # Line: 63
Beside other answers, if you are using Angular and cannot make new angular project and hangs, you can get into the folder and open terminal and write:
npm -i
Maybe useful for other things too!!
I think the npm module madge would help you find the missing dependencies. It goes through your actual code and makes a list of all the dependencies found within. You could then do an npm i for each of the modules found.
If the npm-install-missing does not work for you, knowing the name of the Packages that are missing will help you out here. All I had to do was first open my package.json file inside VSCode, then paste or type the names of the missing modules into it (under dependencies) according to the way other package names were written there.
Then I ran npm install after that.
This method is helpful when you are working on a file but somehow you did not get the package.json file or some of the modules are not listed therein.
Remember to stop and restart a running server after you do npm install for your new dependencies to reflect on your work.
Upgrade your npm version
Install nvm which is easier to switch node js versions
For me node 12.18.3 worked
Just do: nvm use 12.18.3 to switch version
run npm install again and node_modules will appear
To resolve missing npm modules run:
sudo npm install -g npm-install-missing

Resources