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
Related
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.
I was trying to install opencv4nodejs in Ubuntu-20.04 using the following command and my node version is v12.19.0
sudo npm i -g opencv4nodejs
But getting those errors
info install installing opencv version 3.4.6 into directory: /usr/lib/node_modules/opencv4nodejs/node_modules/opencv-build/opencv
ERR! Error: Command failed: mkdir -p opencv
mkdir: cannot create directory ‘opencv’: Permission denied
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! opencv-build#0.1.9 install: `node ./install.js`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the opencv-build#0.1.9 install script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2020-10-28T06_33_21_090Z-debug.log
Running NPM install with sudo might be causing a permissions problem. You could try completely removing the node_modules directory and re-running NPM install it without sudo.
Also make sure you have permission to write to the directory you're installing in?
If it still doesn't work please follow this:
sudo npm install -g opencv4nodejs --unsafe-perm=true --allow-root
This is complete guide to install opencv4nodejs to Linux OS or Raspberry pi (Raspberry Pi OS )
configuration
01- sudo raspi-config expand file system // this is for raspberry pi
After Reboot (sudo reboot now)
02- df -h (To check expand file system)
03- sudo apt-get update && sudo apt-get upgrade -y
04- sudo passwd root // set up your root password
Reboot
To Install NodeJS
01- sudo apt-get install git -y
02- curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash - // replase 12 with latest nodejs (LTS) version
03- sudo apt-get install nodejs -y
04- sudo apt-get install gcc g++ make
To Install opencv4nodejs
01. sudo apt-get install cmake -y
02. sudo npm install -g node-gyp
I am using this steps for raspberry pi os
03. sudo nano /etc/dphys-swapfile
(Increase the CONF_SWAPSIZE from 100 to 1024)
sudo /etc/init.d/dphys-swapfile stop
sudo /etc/init.d/dphys-swapfile start
cd to home dir..
04. mkdir opencv
05. cd opencv
06. sudo npm init -y
07. su
// Enter your setup root password
08. sudo npm install --save opencv4nodejs
09. sudo nano /etc/dphys-swapfile
(Set the CONF_SWAPSIZE back to 100)
In index.js and node_modules in same folder
const cv = require("opencv4nodejs");
In index.js and node_modules in not in same folder
const cv = require("path/opencv/node_modules/opencv4nodejs");
! you don't need to install opencv4nodejs for each folders
You can simply call that above way
Hope guys you can understand it...
Any questions feel free to ask...
Thank you
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
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.
So today I'm trying to install express and I keep getting this error:
npm ERR! Required: {"node":">= 0.8.0"}
npm ERR! Actual: {"npm":"1.1.4","node":"0.6.12"}
I've uninstalled Node and reinstalled it and it still says the same thing. I've updated everything and still it outputs the same error.
A repository is provided on the Installing NodeJS guide which includes the latest version of NodeJS. Try the following to uninstall the current version of node you have installed and install the latest version:
sudo apt-get purge nodejs
sudo apt-get update
sudo apt-get install python-software-properties
sudo add-apt-repository ppa:chris-lea/node.js
sudo apt-get update
sudo apt-get install nodejs
This should install both npm and nodejs
have you installed newest node or NPM ?
sudo apt-get install npm
npm install -g express
to make your express project:
express myapp
Here is the complete instructions