Ionic/Angular Issue Cannot find module './fs'

suzan

I have installed node v10 and trying to install Ionic in my mac.

When I run sudo npm install -g ionic, it shows ionic 4 installed successfully.

But when run ionic -v or ionic serve, it shows the following error

internal/modules/cjs/loader.js:583
    throw err;
    ^

Error: Cannot find module './fs'
    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:22:18)
    at Object.<anonymous> (/usr/local/lib/node_modules/ionic/node_modules/fs-extra/lib/index.js:6:3)
    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)

I have searched for the solution but I could not find any working solution for me.

Any help is appreciated.

suzan

@Edric Comment helped me out.

It is strongly advised to not run npm install -g with sudo.

I uninstalled the ionic and reinstalled without sudo and now it is working just great.

Thank you @Edric.

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

From Java

pytest cannot find module

From Javascript

Cannot find module 'internal/fs' after upgrading to node 7

From Javascript

How to find module "fs" in MS Code with TypeScript?

From

Node cannot find module "fs" when using webpack

From Dev

Cannot find module (a custom module)

From Dev

Cannot find module 'glob'

From Dev

NPM not working (Cannot find module 'internal/fs' - nodejs)

From Dev

Cannot find module 'fs.realpath' after NPM v5.0.1 upgrade

From Dev

Module not found: Error: Cannot resolve module 'fs'

From Dev

Uncaught Error: Cannot find module "fs" when using webpack

From Dev

Cannot find module "fs" - at webpackMissingModule

From Dev

How to fix cannot find module 'fs'

From Dev

Cannot find module 'prettier'

From Dev

cannot find module file

From Dev

Facing issue while Lazy loading a module ( Cannot find module)

From Dev

Cannot find module

From Dev

Cannot Seem to Find issue

From Dev

Cannot find module `mysql`

From Dev

Cannot find module 'ldapjs'

From Dev

cannot find module beautifulsoup

From Dev

Cannot find node module fs when bundling module via scalajs-bundler

From Dev

Cannot find module express

From Dev

Cannot find module "Vector"

From Dev

Webpack: 'Cannot find module' issue when using webpack.ignorePlugin

From Dev

Unable to compile TypeScript: Cannot find module 'fs'

From Dev

error TS2307: Cannot find module 'fs' or its corresponding type declarations

From Dev

Issue with typescript path resolution. (Error: Cannot find module '[module_name]')

From Dev

An issue with creating an npm package: 'Cannot find module ...'

From Dev

React Native: UnhandledPromiseRejectionWarning: Error: Cannot find module 'fs/promises' Require stack:

Related Related

HotTag

Archive