Cannot find module 'semver' when install vue-cli - node.js

Error: Cannot find module 'semver' when install vue-js
OS: Windows 7
node version: v6.17
i uninstalled v6.17 and install 8.3 but not worked..how can i solve?

Try this:
npm install --save -g semver

I tried to fix the problem deleting files and reinstalling again. this works fine for me.
First, remove old staff
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*
sudo apt-get purge nodejs npm
sudo apt autoremove
and then install again with the command:
sudo apt install nodejs

Related

Undoing unsafe PATH changes with sudo

I needed to install a global npm package (on macos), so I ran the following command:
npm install -g <package-name>
I was given an EACCESS error, and I turned to this Stack Overflow question. I ran the following two commands (from Anirban Sanyal's answer):
sudo chown -R root:$(whoami) /usr/local/lib/node_modules/
sudo chmod -R 775 /usr/local/lib/node_modules/
I once again ran the command npm install -g <package-name>, but it threw an EACCESS error again. I then ran this command:
sudo npm install -g <package-name> --unsafe-perm=true --allow-root
which worked, and my package was installed globally.
I am wondering whether any of these commands have changed something in PATH or root permanently, and if so how I can reverse them.

error Cannot find module 'semver' in (npm run dev) command

im using laravel 8 and vuejs to create my website
i have this error after run npm run dev command:
Error: Cannot find module 'semver'
Require stack:
- /usr/share/npm/lib/utils/unsupported.js
- /usr/share/npm/bin/npm-cli.js
...
id tried this solutions:
sudo apt-get purge nodejs --auto-remove
sudo apt-get purge npm --auto-remove
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* ~/.npm
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/bin/node*
sudo rm -rf /usr/local/include/node*
sudo apt-get purge nodejs npm
sudo apt autoremove
npm i -g semver
and then installed again the nodejs and npm (latest version)
but the error still exist
what should i do
There are some modules missing in your /usr/share/npm.
So this will I guess solve the problem
cd /usr/share/npm; npm i
If this doesn't work then you can also just go on installing each missing module in /usr/share/npm.
just try to install npm globally , it will install latest version of npm
sudo npm install -g npm
it worked for me.
The error is basically saying you are missing the module, so you need to install it this way :
npm install semver

Angular | Chunk asset optimisation

This question is a duplicate of 92% chunk asset optimization - webpack
. But there was no satisfactory answer for this.
Actually, at local, I use ng serve or nmp start to start my service and it works fine. But at EC2 instance I need to compress my webpack, so I use ng build --aot --prod.
A week ago, everything was working fine but suddenly it started stuck at this line: 92% chunk asset optimization, I don't know what is going wrong.
That is below:
Your global Angular CLI version (6.0.3) is greater than your local
version (1.6.1). The local Angular CLI version is used.
To disable this warning use "ng config -g cli.warnings.versionMismatch false".
11% building modules 10/14 modules 4 active ...src/assets/css/smartadmin-rtl.min.cssNode#moveTo was deprecated. Use Container#append.
92% chunk asset optimization
The possible reason can be that I have developed and tested everything on npm-6.0.0 and I'm trying to deploy on npm-5.6.0.
But When I try to update it using npm i -g npm to update it shows:
/home/ubuntu/.npm-global/bin/npm -> /home/ubuntu/.npm-global/lib/node_modules/npm/bin/npm-cli.js
/home/ubuntu/.npm-global/bin/npx -> /home/ubuntu/.npm-global/lib/node_modules/npm/bin/npx-cli.js
/home/ubuntu/.npm-global/bin/update -> /home/ubuntu/.npm-global/lib/node_modules/update/bin/update.js
+ to#0.2.9
+ update#0.7.4
+ npm#6.1.0
updated 3 packages in 15.729s
and when I try to run sudo npm i -g npm to update it shows this:
npm ERR! code 1
npm ERR! Command failed: /usr/bin/git clone -g git://github.com/jonschlinkert/resolve-file.got /home/ubuntu/.npm/_cacache/tmp/git-clone-d9e6c8aa
npm ERR! /home/ubuntu/.npm/_cacache/tmp/git-clone-d9e6c8aa/.git: Permission denied
npm ERR!
npm ERR! A complete log of this run can be found in:
npm ERR! /home/ubuntu/.npm/_logs/2018-05-24T14_22_49_199Z-debug.log
I tried searching these error but no help.
Or the other issue can be:
Now my service has started using WebSocket in Angular, which was not there a week ago.
Please help me resolve this.
I had to remove all the angular dependencies from my machine and reinstall using:
sudo apt-get purge npm
sudo apt-get purge node
If above commands won't work then type:
sudo apt-get autoremove
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
sudo rm -rf /usr/local/lib/node*
sudo rm -rf /usr/local/include/node*
sudo rm -rf /usr/local/bin/node*Install NPM
sudo apt-get install npm
Install latest version of NODE
sudo npm cache clean -f
sudo npm install -g n
sudo n stable
Then install angular CLI using:
sudo npm install -g #angular/cli
And then run:
npm build --prod
And error got removed itself, things are working now.

How to uninstall node js on centos 7

I tried to all code command line ssh
rm -r bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node.1
sudo apt-get remove nodejs
sudo make uninstall
./configure then sudo make uninstall
sudo npm rm npm -g
sudo yum remove nodejs
sudo rm -rf bin/node bin/node-waf include/node lib/node lib/pkgconfig/nodejs.pc share/man/man1/node
rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/npm*
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp /opt/local/bin/node opt/local/include/node /opt/local/lib/node_modules
brew uninstall node
sudo rm -rf /usr/local/{lib/node{,/.npm,_modules},bin,share/man}/{npm*,node*,man1/node*}
sudo rm -rf /usr/local/bin/npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
sudo rm -rf /npm /usr/local/share/man/man1/node* /usr/local/lib/dtrace/node.d ~/.npm ~/.node-gyp
node
sudo make uninstall
and remove npm in bin dir
But when node --version still show v6.3.1
How can i do ?

How to install node-xmpp on ubuntu

How to install node-xmpp on Ubuntu.
Dependencies node.js
sudo aptitude install build-essential
sudo apt-get install libssl-dev
Install node.js & npm the correct way
echo 'export PATH=$HOME/local/bin:$PATH' >> ~/.bashrc
. ~/.bashrc
mkdir ~/local
mkdir ~/node-latest-install
cd ~/node-latest-install
curl http://nodejs.org/dist/node-latest.tar.gz | tar xz --strip-components=1
./configure --prefix=~/local
make install
curl http://npmjs.org/install.sh | sh
Install node-xmpp dependencies
sudo apt-get install libexpat1 libexpat1-dev
npm install node-expat
sudo apt-get install libicu-dev
npm install node-stringprep
install node-xmpp
npm install node-xmpp

Resources