Need to install 'webpack-dev-server' - node.js

I have cloned a repo from GitHub for a project. I've already installed node (-v 14.17.5) and npm (-v7.20.6), however when I run npm start I get the following code. I've tried reinstalling node and npm several times but I keep getting the same error:
$ npm start
> simplefolio#1.0.1 start
> webpack server --config webpack.dev.js --open
[webpack-cli] You need to install 'webpack-dev-server' for running 'webpack serve'.
Error: Cannot find module 'webpack-dev-server/bin/cli-flags'
Require stack:
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\#webpack-cli\serve\lib\index.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\lib\webpack-cli.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\lib\bootstrap.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack-cli\bin\cli.js
- C:\Users\edwin\Desktop\git\simplefolio\node_modules\webpack\bin\webpack.js

Remove node_modules and package-lock.json, then npm i again

Remove node modules, then npm i again

In my case, I have node 16.13.0 and npm 7.20.1. Removing nodes_modules, package-lock.json and run npm cache clean --force alone didn't help. The key change for me is upgrading npm version to the latest (8.7.0), then combining with clean install.

Related

Facing error while running ng serve command

I am trying to run ng serve command for my project , i tried npm i command for many times, but it showing same error continously.
Node version is : v16.13.2
Npm version is : 8.4.1
Image is of error
Your Issue
The error you facing with running the application is issue with the SCSS compilation. Certain packages are missing related scss
Try - npm rebuild node-sass --force
If still doesn't work out, freshly recreate the project and follow standard installation of libraries related to scss.
Helping Link:
Angular won't run my ng serve - Sass Loader error
Node Sass does not yet support your current environment: Linux 64-bit with false
Standard Angular Issue Resolution
Delete package-lock.json.
Clear cache - npm cache clean --force or npm cache clean -f
Delete node_modules folder
Reinstall dependencies - npm install
Run the application - ng serve
Please follow below steps to resolve this issue which worked in my case.
Delete node-sass folder (..\ AppData\Roaming\npm-cache\node-sass), node-modules folder and package-lock.json
Clear cache - npm cache clean --force
Reinstall node-sass globally - npm i node-sass#4.13.1 --unsafe-perm=true --allow-root
Reinstall project dependencies - npm install -no-package-lock
Start application - ng serve or npm start
This should update your node-sass global version. (please update version that you need to have as per your project)

Laravel Compilation "Error: Cannot Find PATH/node_modules/laravel-mix/.."

When I run commands like:
npm run dev
npm run watch
to compile my project. I receive an error that says the laravel-mix directory does not exist.
Error: Cannot find module 'PATH/node_modules/laravel-mix/setup/webpack.config.js'
I have deleted the node_modules directory and used npm install to attempt to get it to install properly and it still is not there. "Laravel-mix" is in the package.json file as a dependency, so to my knowledge running npm install or npm install laravel-mix should do the trick, but it isn't working. Any information about this would be greatly appreciated.
npm -v 6.14.1
node -v 12.16.2
Have you already run the following?
npm install laravel-mix
npm install cross-env

Error: Cannot find module '…/webpack' Vue js

npm run build throwing error. Where is the problem?
Used
npm install --save-dev webpack
npm install --save-dev webpack-dev-server
I'ts not working, any idea?
Try to delete node_modules directory and then run npm install and then try tu use npm run build let me know if it works
Just do this.. if you want to clean up the webpack package entirely from Vue
Delete the node_modules
Delete the package-lock.json
npm install
npm run build

npm install throwing error in node-sass

node-sass#2.1.1 install /home/user/Documents/project/node_modules/node-sass
> node scripts/install.js
WARN invalid config loglevel="notice"
Can not download file from https://raw.githubusercontent.com/sass/node-sass-binaries/v2.1.1/linux-x64-node-8.2/binding.node
> node-sass#2.1.1 postinstall /home/user/Documents/project/node_modules/node-sass
> node scripts/build.js
module.js:487
throw err;
^
Error: Cannot find module '/home/user/Documents/project/node_modules/node-sass/node_modules/pangyp/bin/node-gyp'
at Function.Module._resolveFilename (module.js:485:15)
at Function.Module._load (module.js:437:25)
at Function.Module.runMain (module.js:605:10)
at startup (bootstrap_node.js:158:16)
at bootstrap_node.js:575:3
Build failed
added 2186 packages in 42.166s
I tried so far:
npm rebuild
npm rebuild node-sass
npm uninstall -g node-sass
rm -rf node_module
Replace node-sass with sass, which is a pure-JS implementation and is less prone to build errors as it doesn't use node-gyp.
npm uninstall node-sass
npm i -D sass
It can then be added to package.json as follows, for example:
{
"scripts": {
"build:css": "sass --style compressed --update src/scss:static/css",
"watch:css": "sass --watch src/scss:static/css",
}
}
You need to do next steps and it should work:
rm -rf node_modules package-lock.json
npm install --saveDev node-sass#4.5.3
npm install
Voila :)
by using yarn run:
yarn add node-sass
Removed package-lock.json, installed Python 2.7, added an env variable for python path.
Ran npm install.
Voila !
node-sass has minimum dependency according to the version of node installed in your system. You can find out the minimum version required here
Use
Node : v14.16.0
node-sass: ^4.14.1
it works for me
This question is old, but if you arrive here in 2022 or later, then this info may be useful:
node-sass is deprecated. Now you should use sass.
That's why the answer given by Usama Muhammad works. Hope this helps.
Sources:
https://www.npmjs.com/package/node-sass
https://www.npmjs.com/package/dart-sass
The minimum version with Node 8 support is 4.5.3. Offhand, I don't think 2.x will support anything above Node 0.12, which is EOL.
Delete package-lock.json
Remove 'node-sass' dependency from your package.json
run npm install
run npm gulp-sass --save-dev
run npm i -d sass
run npm start
I have found I get node-sass errors when trying to install over a corporate proxy. The first solution is to ensure your .npmrc file has proxy allowance.
.npmrc
# Try removing reference to registry, as sometimes your local corporate registry of node_modules may not include node-sass
# // registry=https://....
# note if using special characters in pass, encode them: eg: h#ppy = h%40ppy
strict-ssl=false
proxy=http://<username>:<pass>#proxyhost:<port>
https-proxy=http://<uname>:<pass>#proxyhost:<port>
NODE_TLS_REJECT_UNAUTHORIZED = 0
Then in command line before running any install
set NODE_TLS_REJECT_UNAUTHORIZED = 0
Zip node-binding files from node-sass github site in order to download them over corporate network.
Example:
https://github.com/inspiraller/node-sass-bindings
Add manually in package.json : "node-sass": "4.13.0"
and update package.json in terminal npm install

npm run Segmentation fault: 11

I'm trying to npm run
HOT=1 node ./node_modules/.bin/react-native-webpack-server start --hot
getting this error:
> projectName#0.0.1 hot /Users/user_name/Documents/dev/app
> HOT=1 node ./node_modules/.bin/react-native-webpack-server start --hot
Segmentation fault: 11
there was no such error 12 hours ago. Have no idea why does this happens.
The suggestion to delete node_modules and re-run npm install is a good one. Even better, though: npm rebuild will likely fix the problem and be faster (since it won't actually re-download all the files etc.).
There was a major node.js release yesterday, maybe that's why something went wrong. Best course of action is updating node.js/npm, deleting node_modules folder and running npm install to install dependencies again.
I also had the same issue now in my angularjs webpack project.
I checked the node version and npm
node -v
v8.11.3
npm -v
5.6.0
I updated the npm to the latest.
npm install -g npm#latest
npm -v
6.4.1
Now npm install, npm run build is working fine now. :)
I also got this same error, and was down to a syntax error in one of my SASS files.
I also faced the same issue.
For me it was due to node version mismatch. I tried running node v8 compatible package, but my node version was set to v6.
rm -r node_modules && npm install

Resources