- I installed a package "cowsay" globally using npm i -g cowsay.
- I ran the "cowsay" command in the terminal as cowsay helloooo and it ran without any error producing output:
< hellooooo >
\ ^__^
\ (oo)\_______
(__)\ )\/\
||----w |
|| ||
in my local Project javascript file, I typed the code const cowsay = require("cowsay"), when i try to run the node "index.js", again produced the error: Cannot find module cowsay
Finally used the command node link cowsay, the error is:
*node:internal/modules/cjs/loader:1078
throw err;
^
Error: Cannot find module 'F:\Web Development\JavaScript\Node\Jokester\link'
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Module._load (node:internal/modules/cjs/loader:920:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.16.0*
I was trying to install cowsay package globally and run it in my local Project using npm link <module_name> but the following error is thrown:
*node:internal/modules/cjs/loader:1078
throw err;
^
Error: Cannot find module 'F:\Web Development\JavaScript\Node\Jokester\link'
at Module._resolveFilename (node:internal/modules/cjs/loader:1075:15)
at Module._load (node:internal/modules/cjs/loader:920:27)
at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:81:12)
at node:internal/main/run_main_module:23:47 {
code: 'MODULE_NOT_FOUND',
requireStack: []
}
Node.js v18.16.0*