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

后端 未结 18 2897
悲哀的现实
悲哀的现实 2020-12-12 09:34

I always get this error message when I run \"Ionic start project name\":

Error message

Running command - failed![ERROR] An error occurred while run         


        
相关标签:
18条回答
  • 2020-12-12 10:16

    If you are using "n" library @ https://github.com/tj/n . Do the following

      echo $NODE_PATH
    

    If node path is empty, then

    sudo n latest    - sudo is optional depending on your system
    

    After switching Node.js versions using n, npm may not work properly.

    curl -0 -L https://npmjs.com/install.sh | sudo sh
    echo NODE_PATH
    

    You should see your Node Path now. Else, it might be something else

    0 讨论(0)
  • 2020-12-12 10:16

    I was running into a similar issue where the whole ../lib/utils directory couldn't be found when I tried executing Mocha via npm test. I tried the mentioned solutions here with no luck. Ultimately I ended up uninstalling and reinstalling the Mocha package that was a dependency in the npm project I was working in and it worked after that. So if anyone's having this issue with an npm package installed as a dependency, try uninstalling and reinstalling the package if you haven't already!

    0 讨论(0)
  • 2020-12-12 10:17

    This may happen when the npm/lib folder got emptied for some reason (could also happen due to permission issues in the last usage).

    A reinstallation of the node could solve the issue (as stated on other answers here), but I would suggest using a wonderful tool called nvm (Node Version Manager), which is able to manage multiple version of node and npm - this is mostly useful on dev machines with more than one projects require different versions of node.

    When you install nvm, this message will go away and you will have the latest version of node and npm to use.

    In order to see the list of currently installed node versions in your nvm, just run:

    nvm list
    

    In order to install and use a new node version, run:

    nvm install <node_version>
    

    For example to install latest version of node 10.x, run:

    nvm install 10
    

    In order to switch to currently installed version, run:

    nvm use <node_version>
    

    In order to switch to system's original node version, just run:

    nvm use system
    

    Hope this helps.

    Good luck!

    0 讨论(0)
  • 2020-12-12 10:20

    In my case it was $NODE_PATH missing:

    NODE="/home/ubuntu/local/node" #here your user account after home
    NODE_PATH="/usr/local/lib/node_modules" 
    PATH="$PATH:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:$NODE/bin:$NODE/lib/node_modules"
    

    To check just echo $NODE_PATH empty means it is not set. Add them to .bashrc is recommended.

    0 讨论(0)
  • 2020-12-12 10:20

    In my macOS (10.13.3), I got it solved after reinstalling Node version manager.

    curl -o- https://raw.githubusercontent.com/creationix/nvm/v0.33.11/install.sh | bash
    source ~/.bashrc
    
    0 讨论(0)
  • 2020-12-12 10:22

    On fedora 27 I solved the problem by doing this:

    sudo rm -f  /usr/local/lib/node_modules/npm
    sudo dnf reinstall nodejs
    
    0 讨论(0)
提交回复
热议问题