NodeJS - How to properly install and run Webpack on Windows 10? - node.js

I downloaded existing Web project and tried to run:
webpack --watch --progress
but it keeps saying:
webpack --watch --progress
One CLI for webpack must be installed. These are recommended choices, delivered as separate packages:
- webpack-cli (https://github.com/webpack/webpack-cli)
The original webpack full-featured CLI.
We will use "npm" to install the CLI via "npm install -D".
Do you want to install 'webpack-cli' (yes/no): yes
Installing 'webpack-cli' (running 'npm install -D webpack-cli')...
npm WARN #ngtools/webpack#1.10.2 requires a peer of webpack#^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-codemirror#1.1.3 requires a peer of #angular/core#^2.1.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-codemirror#1.1.3 requires a peer of #angular/forms#^2.1.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN ng2-codemirror#1.1.3 requires a peer of #angular/common#^2.1.0 || ^4.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware#1.12.2 requires a peer of webpack#^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server#2.11.3 requires a peer of webpack#^2.2.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
+ webpack-cli#3.1.2
added 2 packages from 2 contributors, removed 1 package, updated 3 packages and audited 24726 packages in 16.453s
found 1 high severity vulnerability
run `npm audit fix` to fix them, or `npm audit` for details
{ Error: Cannot find module 'webpack-cli'
at Function.Module._resolveFilename (internal/modules/cjs/loader.js:580:15)
at Function.Module._load (internal/modules/cjs/loader.js:506:25)
at Module.require (internal/modules/cjs/loader.js:636:17)
at require (internal/modules/cjs/helpers.js:20:18)
at runCommand.then (...\AppData\Roaming\npm\node_modules\webpack\bin\webpack.js:142:5)
at process._tickCallback (internal/process/next_tick.js:68:7) code: 'MODULE_NOT_FOUND' }
Does WebPack require specific NPM/Node version? (maybe newer version is not compatible with older one)..

https://stackoverflow.com/a/41305211
Oleg Pro's help did the trick for me, specifically putting node_modules/.bin in my path as he describes in part 3.
With my versions of webpack (4.29.0) and Node (v10.15.0), I didn't find node_modules/.bin/webpack-cmd (as he specifies in 1.) in my project directory; I found node_modules/.bin/webpack-cli.
The install appears to work, as I then used webpack to install Vue, which in turn generated app.vue and hello_vue.js files. However, vue --version returns vue:command not found, so I'm adopting a wait and see attitude.

Related

Vulnerabilities appears npm install npm audit npm audit fix --force in windows 10 , npm 6.4.1 node v10.13.0

npm audit
=== npm audit security report ===
Manual Review
Some vulnerabilities require your attention to resolve
Visit https://go.npm.me/audit-guide for additional guidance
Moderate Prototype Pollution
Package hoek
Patched in > 4.2.0 < 5.0.0 || >= 5.0.3
Dependency of otp.js [dev]
Path otp.js > joi > hoek
More info https://nodesecurity.io/advisories/566
Low Denial of Service
Package mem
Patched in >=4.0.0
Dependency of react-native
Path react-native > #react-native-community/cli > metro >
metro-inspector-proxy > yargs > os-locale > mem
More info https://nodesecurity.io/advisories/1084
.......
npm audit fix --force
Error:
npm WARN using --force I sure hope you know what you are doing.
npm WARN commonmark-react-renderer#4.3.4 requires a peer of commonmark#^0.27.0 || ^0.26.0 || ^0.24.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb#17.1.1 requires a peer of eslint#^4.19.1 || ^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-airbnb-base#13.2.0 requires a peer of eslint#^4.19.1 || ^5.3.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-native#3.7.0 requires a peer of eslint#^3.17.0 || ^4 || ^5 but none is installed. You must install peer dependencies yourself.
npm WARN jsdom#15.2.1 requires a peer of canvas#^2.5.0 but none is installed. You must install peer dependencies yourself.
npm WARN ws#7.2.3 requires a peer of bufferutil#^4.0.1 but none is installed. You must install peer dependencies yourself.
npm WARN ws#7.2.3 requires a peer of utf-8-validate#^5.0.2 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-fast-image#7.0.2 requires a peer of react-native#^0.60.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-keyboard-input#5.4.1 requires a peer of react-native#^0.57.3 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-responsive-ui#1.1.1 requires a peer of react#16.0.0-alpha.6 but none is installed. You must install peer dependencies yourself.
npm WARN react-native-responsive-ui#1.1.1 requires a peer of react-native#^0.43.4 but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-drawer#1.4.0 requires a peer of react-native-screens#^1.0.0 || ^1.0.0-alpha but none is installed. You must install peer dependencies yourself.
npm WARN react-navigation-stack#1.10.3 requires a peer of react-native-screens#^1.0.0 || ^1.0.0-alpha but none is installed. You must install peer dependencies yourself
>
>
up to date in 20.457s
fixed 0 of 6 vulnerabilities in 1710074 scanned packages
6 vulnerabilities required manual review and could not be updated
anyone could help plz????
problem was with 'npm install' and 'npm yarn install'
This helped me
'choco install yarn'
'cd project_folder'
'yarn global add react-native-cli'
'yarn'

NPM unmet peer dependency on every package i try to install

I am very new to the frustrating world of NPM.
I have run create-react-app, it installs except for the following warning messages
yarn add v1.17.3
[1/4] Resolving packages...
warning react-scripts > fsevents#2.0.6: Please update: there are crash fixes
[2/4] Fetching packages...
info fsevents#1.2.9: The platform "linux" is incompatible with this module.
info "fsevents#1.2.9" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents#2.0.6: The platform "linux" is incompatible with this module.
info "fsevents#2.0.6" is an optional dependency and failed compatibility check. Excluding it from installation.
[3/4] Linking dependencies...
warning "react-scripts > #typescript-eslint/eslint-plugin#1.6.0" has unmet peer dependency "typescript#*".
warning "react-scripts > #typescript-eslint/parser#1.6.0" has unmet peer dependency "typescript#*".
warning "react-scripts > #typescript-eslint/eslint-plugin > #typescript-eslint/typescript-estree#1.6.0" has unmet peer dependency "typescript#*".
warning "react-scripts > #typescript-eslint/eslint-plugin > tsutils#3.10.0" has unmet peer dependency "typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 11 new dependencies.
Once it goes through to the end, if i try to install another package (any package) i.e npm install bootstrap --save i keep getting errors like;
npm WARN deprecated left-pad#1.3.0: use String.prototype.padStart()
npm WARN deprecated flatten#1.0.2: I wrote this module a very long time ago; you should use something else.
npm WARN deprecated fsevents#2.0.6: Please update: there are crash fixes
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/jest as it wasn't installed by /home/vagrant/admin/node_modules/jest
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/uglifyjs as it wasn't installed by /home/vagrant/admin/node_modules/uglify-js
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/semver as it wasn't installed by /home/vagrant/admin/node_modules/semver
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/esparse as it wasn't installed by /home/vagrant/admin/node_modules/esprima
npm WARN rm not removing /home/vagrant/admin/node_modules/.bin/esvalidate as it wasn't installed by /home/vagrant/admin/node_modules/esprima
npm WARN bootstrap#4.3.1 requires a peer of jquery#1.9.1 - 3 but none is installed. You must install peer dependencies yourself.
npm WARN bootstrap#4.3.1 requires a peer of popper.js#^1.14.7 but none is installed. You must install peer dependencies yourself.
npm WARN #typescript-eslint/parser#1.6.0 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
npm WARN #typescript-eslint/eslint-plugin#1.6.0 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
npm WARN ts-pnp#1.1.2 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
npm WARN #typescript-eslint/typescript-estree#1.6.0 requires a peer of typescript#* but none is installed. You must install peer dependencies yourself.
npm WARN tsutils#3.15.0 requires a peer of typescript#>=2.8.0 || >= 3.2.0-dev || >= 3.3.0-dev || >= 3.4.0-dev || >= 3.5.0-dev || >= 3.6.0-dev || >= 3.6.0-beta || >= 3.7.0-dev || >= 3.7.0-beta but none is installed. You must install peer dependencies yourself.
npm ERR! path /home/vagrant/admin/node_modules/#hapi/topo/node_modules/#hapi/hoek/package.json.1181420959
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open
npm ERR! enoent ENOENT: no such file or directory, open '/home/vagrant/admin/node_modules/#hapi/topo/node_modules/#hapi/hoek/package.json.1181420959'
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent
npm ERR! A complete log of this run can be found in:
npm ERR! /home/vagrant/.npm/_logs/2019-08-05T11_56_29_110Z-debug.log
I have tried updating the packages using `npm -g update. But still nothing
Any help would be greatly appreciated, its driving me NUTS!
There are a number of packages on npm that attempt to solve this very problem in different ways. I've used npx npm-install-peers in the past, but I had to run it again after every new install, as the peer dependencies were wiped out on every normal npm install.
Edit: you might want to add npm-install-peers to both postinstall and postuninstall scripts so you don't have to do it manually each time you (un)install something.
I just ran:
npm install typescript
to install the latest and now I don't see that peer package error. You could also install it global, I suppose:
npm install -g typescript
which would most certainly work just the same.

Why does bootstrap-vue require me to install jquery and webpack manually, even though I have them installed globally?

Im setting up a new bootstrap-vue project using vue-cli by running the command
vue init bootstrap-vue/webpack-simple my-project.
Each time I start a new project, I have to install all the dependencies in the output below by hand.
Am I missing something?
I already have installed jquery/webpack etc globally using npm install -g webpack but whenever I run the command I get the following output:
npm WARN ajv-keywords#3.2.0 requires a peer of ajv#^6.0.0 but none is
installed. You must install peer dependencies yourself.
npm WARN babel-loader#6.4.1 requires a peer of webpack#1 || 2 || ^2.1.0-
beta || ^2.2.0-rc but none is installed. You must install peer
dependencies
yourself.
npm WARN bootstrap#4.2.1 requires a peer of jquery#1.9.1 - 3 but none is
installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4
(node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for
fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current:
{"os":"win32","arch":"x64"})
Im pretty new to understanding npm and js dependency management, and it just doesn't make sense that every time I spawn up a new project, I have to manually go down the line and install the various dependencies by hand. Am I missing something?

NPM Warnings "eslint X requires a peer of Y but none is installed. You must install peer dependencies yourself."

Whenever I install a package I keep getting these npm warnings regarding eslint. I've tried every form of installing the latest version of eslint and babel-eslint that I can think of, but the same warning messages show every time. For instance if I run
npm i babel-eslint
The follwing shows:
npm WARN eslint-config-react-app#2.1.0 requires a peer of babel-eslint#^7.2.3 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app#2.1.0 requires a peer of eslint#^4.1.1 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-loader#1.9.0 requires a peer of eslint#>=1.6.0 <5.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-jsx-a11y#5.1.1 requires a peer of eslint#^2.10.2 || ^3 || ^4 but none is installed. You must install peer dependencies yourself.
npm WARN firebase-functions#2.1.0 requires a peer of firebase-admin#~6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.2.4 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.2.4: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
Despite the warnings it shows that the package added. But if it's added then why do those warnings persist?
babel-eslint#10.0.1
removed 181 packages and updated 1 package in 50.436s
One thing I notice whenever I install via NPM is that at first the first line of the console shows
[..................] - rollbackFailedOptional: verb npm-session 1b360c8942244b42
Although it does go on to install the package, with those subsequent warning errors. Could anyone suggest a reason for all these errors and a possible way to fix them?

Getting warnings while installing npm

npm WARN extract-text-webpack-plugin#1.0.1 requires a peer of webpack#^1.9.11 but none is installed. You must install peer dependencies yourself.
npm WARN karma-webpack#1.7.0 requires a peer of webpack#^1.4.0 but none is installed. You must install peer dependencies yourself.
npm WARN react-native#0.49.2 requires a peer of react#16.0.0-beta.5 but none is installed. You must install peer dependencies yourself.
npm WARN sass-loader#3.2.0 requires a peer of webpack#^1.12.6 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware#1.12.0 requires a peer of webpack#^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-server#2.0.0-beta requires a peer of webpack#>=2.0.3-beta <3 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents#1.1.2 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents#1.1.2: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
I'm getting above mentioned warnings while doing npm install. Although, these are just warnings and are not gonna impact application. But, I want to know what is leading to these warnings.
I am using npm `version 5.4.2`
node version is 6.11.4
webpack 2.1.0-beta.22
first of all last 2 warnings are just for those user who are using
other than mac.(Even I wasn't able to resolve them)
Now coming to other warnings.
you can either downgrade your webpack version or upgrade everything to latest versions.
They are compatible with each other as I have also done that.
In my opinion upgrading all your components is a better way to solve this.
This module will be helpful while upgrading it npm-check

Resources