Error: Cannot find module 'update-notifier'. I cannot install any NPM - javascript

There is a similar question on StackOverFlow but it was unhelpful and it wasn't answered. I have been working on a project and I currently am receiving this error.
Error: Cannot find module 'update-notifier'
at Function.Module._resolveFilename (module.js:536:15)
at Function.Module._load (module.js:466:25)
at Module.require (module.js:579:17)
at require (internal/module.js:11:18)
at /usr/local/lib/node_modules/npm/bin/npm-cli.js:29:19
at Object.<anonymous> (/usr/local/lib/node_modules/npm/bin/npm-cli.js:92:3)
at Module._compile (module.js:635:30)
at Object.Module._extensions..js (module.js:646:10)
at Module.load (module.js:554:32)
at tryModuleLoad (module.js:497:12)
If I type any command that includes npm it returns the same error, I can't install anything.
I have tried to uninstall/re-install NodeJS with homebrew but nothing changed from trying that.

Related

Struggling with running Storybook

Hi I'm a beginner learning React & I'm trying out Storybook and I am having the following error when I try to run Storybook. **I tried to update by using npm update, I thought there was conflict with my dependencies **
ERROR in ./.storybook/generated-refs.js
Module build failed (from ./node_modules/babel-loader/lib/index.js):
Error: You gave us a visitor for the node type StaticBlock but it's not a valid type
at verify (C:\Users\msngw\OneDrive\Desktop\SBook\myapp\node_modules\#babel\traverse\lib\visitors.js:112:13)
at explode (C:\Users\msngw\OneDrive\Desktop\SBook\myapp\node_modules\#babel\traverse\lib\visitors.js:34:3)
at Object.merge (C:\Users\msngw\OneDrive\Desktop\SBook\myapp\node_modules\#babel\traverse\lib\visitors.js:147:5)
at Object.<anonymous> (C:\Users\msngw\OneDrive\Desktop\SBook\myapp\node_modules\#babel\helper-replace-supers\lib\index.js:60:44)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
at require (internal/modules/cjs/helpers.js:74:18)
at Object.<anonymous> (C:\Users\msngw\OneDrive\Desktop\SBook\myapp\node_modules\#babel\helper-create-class-features-plugin\lib\fields.js:13:52)
at Module._compile (internal/modules/cjs/loader.js:1015:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:1035:10)
at Module.load (internal/modules/cjs/loader.js:879:32)
at Function.Module._load (internal/modules/cjs/loader.js:724:14)
at Module.require (internal/modules/cjs/loader.js:903:19)
# multi ./node_modules/#storybook/core/dist/server/common/polyfills.js ./node_modules/#storybook/core/dist/client/manager/index.js ./node_modules/#storybook/addon-links/dist/register.js ./node_modules/#storybook/addon-actions/dist/register.js ./node_modules/#storybook/addon-docs/dist/register.js ./node_modules/#storybook/addon-controls/dist/register.js ./node_modules/#storybook/addon-backgrounds/dist/register.js ./node_modules/#storybook/addon-viewport/dist/register.js ./node_modules/#storybook/addon-toolbars/dist/register.js ./.storybook/generated-refs.js main[9]
This bug has been already raised in the Storybook repo. As mentioned there, removing yarn.lock and node_modules, then re-installing using yarn, fixed all issues.

How to fix 'Error: Cannot find module '/lib/index' on Node JS

I'm adding 1 new library to my project (express-fileupload), but, when run node server this return that message, I tried with the commands:
npm install
npm loader
npm install winston (this for a problem reported in a Github project)
npm start
but this dont work.
$ node server.js
internal/modules/cjs/loader.js:605
throw err;
^
Error: Cannot find module '/lib/index'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:603:15)
at Function.Module._load (internal/modules/cjs/loader.js:529:25)
at Module.require (internal/modules/cjs/loader.js:657:17)
at require (internal/modules/cjs/helpers.js:22:18)
at Object.<anonymous> (C:\Users\david\Documents\INTRANET\dusoft-server\server.js:15:18)
at Module._compile (internal/modules/cjs/loader.js:721:30)
at Object.Module._extensions..js (internal/modules/cjs/loader.js:732:10)
at Module.load (internal/modules/cjs/loader.js:620:32)
at tryModuleLoad (internal/modules/cjs/loader.js:560:12)
at Function.Module._load (internal/modules/cjs/loader.js:552:3)

Can't load the Canvas module in Node.js in Ubuntu

I haven't been able to load the Canvas module into my Node.js application. When I include the line
const Canvas = require('canvas');
I end up getting the error:
module.js:681
return process.dlopen(module, path._makeLong(filename));
^
Error: /home/artezanz/Documents/Developer/Discord/sun-qiang/node_modules/canvas/build/Release/canvas.node: undefined symbol: _ZN5Image5errorEN2v85LocalINS0_5ValueEEE
at Object.Module._extensions..node (module.js:681:18)
at Module.load (module.js:565:32)
at tryModuleLoad (module.js:505:12)
at Function.Module._load (module.js:497:3)
at Module.require (module.js:596:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/home/artezanz/Documents/Developer/Discord/sun-qiang/node_modules/canvas/lib/bindings.js:3:18)
at Module._compile (module.js:652:30)
at Object.Module._extensions..js (module.js:663:10)
at Module.load (module.js:565:32)
For reference, I'm working on Ubuntu, with version 6.1.0 of npm and v8.11.3 of Node.js (the LTS version). Do I need to switch to the latest version of Node to be able to use the Canvas library?
Let me know if there's any additional information needed.

How to fix webpack module issues in Canvas project?

I am trying to run a canvas project in local(development) environment by referring https://github.com/instructure/canvas-lms/wiki/Quick-Start
If I try to run rails server then it throws an error like RuntimeError (you need to run webpack). While fixing this issue, I have referred some blogs and try to run webpack server. Again it will throws an error like Error: Cannot find module ...
Example:
module.js:487
throw err;
^
Error: Cannot find module 'yargs'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Module.require (module.js:513:17)
at require (internal/module.js:11:18)
at Object.<anonymous> (/usr/local/lib/node_modules/webpack/bin/webpack.js:16:13)
at Module._compile (module.js:569:30)
at Object.Module._extensions..js (module.js:580:10)
at Module.load (module.js:503:32)
at tryModuleLoad (module.js:466:12)
at Function.Module._load (module.js:458:3)
I am using Ubuntu 16.04 and webpack version is 3.0.0
How can I fix these issues? Please help me to run this canvas project.

Error: Cannot find module 'google-protobuf'

Following to my previous question, I'm trying to use protocol buffers in node.js. I've generated ServiceMessage_pb.js from my ServiceMessage.proto, and add the following code:
var messages = require('./ServiceMessage_pb');
Now I'm getting the following error in my node log:
Error: Cannot find module 'google-protobuf'
at Function.Module._resolveFilename (module.js:325:15)
at Function.Module._load (module.js:276:25)
at Module.require (module.js:353:17)
at require (internal/module.js:12:17)
at Object.<anonymous> (/home/aii/ws/ServiceMessage_pb.js:8:12)
at Module._compile (module.js:409:26)
at Object.Module._extensions..js (module.js:416:10)
at Module.load (module.js:343:32)
at Function.Module._load (module.js:300:12)
at Module.require (module.js:353:17)
Any suggestions how to solve this?
Thanks
npm i google-protobuf
I run into so many problem installing just "protobuf" !
Also the official protobuf javascript package is "google-protobuf":
https://www.npmjs.com/package/google-protobuf
You can install the module with npm:
npm install --save protobuf
Then require it this way:
var my_protobuff = require ("protobuf");

Categories