After $npm install, Getting Error: Cannot find module '../lib/utils/unsupported.js'

后端 未结 12 2123
星月不相逢
星月不相逢 2021-02-03 21:52

I just came back to work on a React project after working in the Rails environment and found that I cannot run any NPM commands in my Mac terminal. I\'ve tried all the remedies

相关标签:
12条回答
  • 2021-02-03 22:08

    In my case, this happened after I performed a machine-wide clean-up of all node_modules folders. I had node installed with nvm and I started getting this error, no matter what node-related action I wanted to trigger:

    Error: Cannot find module '../lib/utils/unsupported.js'
    

    I solved it by doing the following:

    1. Restarted my computer
    2. Uninstalled nvm
    3. Installed a different node version
    0 讨论(0)
  • 2021-02-03 22:13
    1. Uninstall node brew uninstall --force node
    2. Remove the /usr/local/lib/node_modules folder
    3. Install it again brew install node
    0 讨论(0)
  • 2021-02-03 22:13

    None of the other answered solved my issue. After reinstalling Node, I still got the same error (even when I just wrote npm -v).

    I followed this answer here (removing everything called node and npm), which solved it for me.

    0 讨论(0)
  • 2021-02-03 22:16

    I'm sorry, but in my case I get the same error, because, my index.js is inside de src folder, make sure that you are in the seme directory of your index.js to run

    0 讨论(0)
  • 2021-02-03 22:18

    I had the same error after brew upgradeon mac. I did brew postinstall node and that fixed it.

    0 讨论(0)
  • 2021-02-03 22:22

    This happened to me after installing yarn.

    in a terminal:

    brew uninstall --force --ignore-dependencies node
    brew install node
    

    if you have trouble symlinking node, in the same terminal:

    sudo chown -R `whoami`:admin /usr/local/include
    sudo chown -R `whoami`:admin /usr/local/bin
    sudo chown -R `whoami`:admin /usr/local/share
    sudo chown -R `whoami`:admin /usr/local/lib
    brew link --overwrite node
    

    Check that your re-installation worked by typing the following in the terminal:

    node -v
    
    0 讨论(0)
提交回复
热议问题