How to update globally installed packages in nvm Windows? - npm

I want to update:
$ npm outdated -g --depth=0
Package Current Wanted Latest Location
npm 6.12.1 6.14.18 9.2.0 global
prettier 2.8.1 2.8.2 2.8.2 global
I followed https://stackoverflow.com/a/56806361/8001538 but node npm-cli.js update -g --force doesn't work. It gives this error:
$ node npm-cli.js update -g --force
internal/modules/cjs/loader.js:895
throw err;
^
Error: Cannot find module '../lib/utils/unsupported.js'
Require stack:
- C:\Users\sunil\AppData\Roaming\nvm\v13.1.0\node_modules\npm.old\bin\npm-cli.js
←[90m at Function.Module._resolveFilename (internal/modules/cjs/loader.js:892:15)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:785:27)←[39m
←[90m at Module.require (internal/modules/cjs/loader.js:956:19)←[39m
←[90m at require (internal/modules/cjs/helpers.js:74:18)←[39m
at C:\Users\sunil\AppData\Roaming\nvm\v13.1.0\node_modules\←[4mnpm.old←[24m\bin\npm-cli.js:19:21
at Object.<anonymous> (C:\Users\sunil\AppData\Roaming\nvm\v13.1.0\node_modules\←[4mnpm.old←[24m\bin\npm-cli.js:153:3)
←[90m at Module._compile (internal/modules/cjs/loader.js:1063:30)←[39m
←[90m at Object.Module._extensions..js (internal/modules/cjs/loader.js:1103:10)←[39m
←[90m at Module.load (internal/modules/cjs/loader.js:914:32)←[39m
←[90m at Function.Module._load (internal/modules/cjs/loader.js:822:14)←[39m {
code: ←[32m'MODULE_NOT_FOUND'←[39m,
requireStack: [
←[32m'C:\\Users\\sunil\\AppData\\Roaming\\nvm\\v13.1.0\\node_modules\\npm.old\\bin\\npm-cli.js'←[39m
]
}

Related

Error: Cannot find module '../lib/cli.js'

i installed yarn/webpack and after that npm crashed! I get the following error:
npm -v
node:internal/modules/cjs/loader:928
throw err;
^
Error: Cannot find module '../lib/cli.js'
Require stack:
- /usr/local/lib/node_modules/npm/bin/npm-cli.js
at Function.Module._resolveFilename (node:internal/modules/cjs/loader:925:15)
at Function.Module._load (node:internal/modules/cjs/loader:769:27)
at Module.require (node:internal/modules/cjs/loader:997:19)
at require (node:internal/modules/cjs/helpers:92:18)
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:2:1)
at Module._compile (node:internal/modules/cjs/loader:1108:14)
at Object.Module._extensions..js (node:internal/modules/cjs/loader:1137:10)
at Module.load (node:internal/modules/cjs/loader:973:32)
at Function.Module._load (node:internal/modules/cjs/loader:813:14)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
code: 'MODULE_NOT_FOUND',
requireStack: [ '/usr/local/lib/node_modules/npm/bin/npm-cli.js' ]
}
The error appears whatever I like to do with npm. I'm working on Mac OSX 10.14.6
Node Version: 15.4.0
Yarn Version: 1.22.10
thanks for help.
This happened to me when I used brew install node. I fixed it by doing brew uninstall node (just to clean up) and then installing nodejs by downloading the package from https://nodejs.org/
Just uninstall using brew uninstall node, download and install package from https://nodejs.org.

Problem when using generator-rn-toolbox to apply icon

I use generator-rn-toolbox to set icon and splash screen for my react-native app as instructions
- install generator npm install -g yo generator-rn-toolbox
- install brew brew install imagemagick
- generate icons yo rn-toolbox:assets --icon ~/Desktop/logo.png
Then I encountered an error as below
internal/modules/cjs/loader.js:584
throw err;
^
Error: Cannot find module 'universal-analytics'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
at Function.Module._load (internal/modules/cjs/loader.js:508:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-rn-toolbox/analytics.js:1:74)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
at Function.Module._load (internal/modules/cjs/loader.js:531:3)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (/usr/local/lib/node_modules/generator-rn-toolbox/generators/assets/index.js:5:19)
at Module._compile (internal/modules/cjs/loader.js:701:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
at Module.load (internal/modules/cjs/loader.js:600:32)
I tried to run npm install universal-analytics but it doesn't work. Do you have any solutions?
I solved by
npm remove -g yo generator-rn-toolbox
npm install -g yo generator-rn-toolbox
We look forward to helping you

How to fix error "Cannot find module" using "expo start"

After upgrading expo-cli to the latest version. I tried starting my app with 'expo start' but I got this error
C:\Users\DevLewa\Desktop\app\AgroSprite>expo
internal/modules/cjs/loader.js:638
throw err;
^
Error: Cannot find module 'split-string'
at Function.Module._resolveFilename
(internal/modules/cjs/loader.js:636:15)
at Function.Module._load (internal/modules/cjs/loader.js:562:25)
at Module.require (internal/modules/cjs/loader.js:690:17)
at require (internal/modules/cjs/helpers.js:25:18)
at Object.<anonymous>
(C:\Users\DevLewa\AppData\Roaming\npm\node_modules\exp
o-cli\node_modules\braces\lib\utils.js:3:19)
at Module._compile (internal/modules/cjs/loader.js:776:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
at Module.load (internal/modules/cjs/loader.js:653:32)
at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
at Function.Module._load (internal/modules/cjs/loader.js:585:3)
How do I fix this please?
rollback to version 2.4.3
npm install -g expo-cli#2.4.3
I installed the missing module using
npm install -g split-string
and it worked.
I faced the same problem . I uninstalled expo-cli and nodejs and installed again. It works for me.

Cannot find module 'cli-cursor' vue-cli

i installed vue-cli
but when i run
vue create -f name
i get this error :
internal/modules/cjs/loader.js:583
throw err;
^
Error: Cannot find module 'cli-cursor'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:581:15)
at Function.Module._load (internal/modules/cjs/loader.js:507:25)
at Module.require (internal/modules/cjs/loader.js:637:17)
at require (internal/modules/cjs/helpers.js:20:18)
at Object.<anonymous> (C:\Users\mrkinix\AppData\Roaming\npm\node_modules\#vue\cli\node_modules\inquirer\lib\prompts\list.js:9:17) at Module._compile (internal/modules/cjs/loader.js:689:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:700:10) at Module.load (internal/modules/cjs/loader.js:599:32)
at tryModuleLoad (internal/modules/cjs/loader.js:538:12) at Function.Module._load (internal/modules/cjs/loader.js:530:3)
PS D:\New folder>
Install cli-cursor globally using npm or yarn:
$ npm install -g cli-cursor
or,
$ yarn global add cli-cursor

Why can I not start the Vue UI after installing the Vue CLI?

Using the following:
node 8.11.2
npm 6.3.0
I then try to install the Vue CLI (#vue/cli#3.0.0):
npm i -g #vue/cli
but when I run the following command:
vue ui
I get the following error:
Error: Cannot find module 'core-js/modules/es7.object.entries'
at Function.Module._resolveFilename (module.js:547:15)
at Function.Module._load (module.js:474:25)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (C:\Apps\caches\npm\node_modules\#vue\cli\node_modules\apollo-upload-server\lib\mi
ddleware.js:14:1)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
It turned out I had to install the core-js package explicitly.
npm i -g core-js
Not sure why this wasn't installed as a dependency though.
The issue has been reported HERE and has been fixed in v3.0.1.