1

I have a pi4 and am very new to it so

I have installed npm and nodejs but it wont run any packeges, I get an "throw err; cannot find module ´internal/util/types´.

I run ´npm -v´ and get the same messge as above. I run ´apt-get -f install npm´ and get npm is alredy newst version (5.8.0+ds6-4). I run ´nodejs -v´ and get v10.15.2.

Sorry if this is a very badley explaind problem, my knowlege in this is at a very basic level.

1
  • what research have you done?
    – jsotola
    Commented Aug 2, 2019 at 2:27

1 Answer 1

1

I solved it by removing everything I could think of. Then I installed it from scratch. Here are the commands I did:

sudo rm -rf ~/.nvm
hash -r

# Remove latest node version
sudo npm uninstall -g n

# Remove n
cd ~/src/n && sudo make uninstall && cd .. && sudo rm -r n

# Remove latest nodejs version
sudo apt-get purge -y nodejs npm

# Remove nodejs-legacy version
sudo apt-get purge -y nodejs-legacy npm

sudo apt -y autoremove

# Remove nodejs files
sudo rm -rf /usr/local/lib/node_modules/npm
sudo rm -rf /usr/local/lib/node_modules/n
sudo rm -f /usr/local/bin/node
sudo rm -f /usr/local/bin/npm
sudo rm -f /usr/bin/node
sudo rm -rf /usr/local/n/versions/node

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.