Installation of webpack and webpack-cli (both-D) in the project is complete, but checking the version number is not found?

problem description

installation of webpack and webpack-cli (both-D) in the project is complete, but checking the version number is not found?

the environmental background of the problems and what methods you have tried

there are hundreds of times but no effective solution has been found

related codes

/ / Please paste the code text below (do not replace the code with pictures)
(- install webpack-)
zhaohaorandeMacBook-Pro:webpack aaron$ npm install-D webpack

fsevents@1.2.4 install / Users/aaron/Desktop/webpack/node_modules/fsevents
node install
[fsevents] Success: "/ Users/aaron/Desktop/webpack/node_modules/fsevents/lib/binding/Release/node-v57-darwin-x64/fse.node" already installed
Pass-- update-binary to reinstall or-- build-from-source to recompile
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN dome@1.0.0 No description
npm WARN dome@1.0.0 No repository field.
  • webpack@4.25.1

added 383 packages from 298 contributors and audited 4147 packages in 77.08s
found 0 vulnerabilities

(- install webpack-cli-)
zhaohaorandeMacBook-Pro:webpack aaron$ npm install-D webpack-cli
npm WARN registry Using stale data from from https://registry.npmjs.org/ due to a request error during revalidation.
npm WARN dome@1.0.0 No description
npm WARN dome@1.0.0 No repository field.

  • webpack-cli@3.1.2

added 70 packages from 15 contributors in 56.973s

query version number (- not found? -)
zhaohaorandeMacBook-Pro:webpack aaron$ webpack-v
-bash: webpack: command not found
zhaohaorandeMacBook-Pro:webpack aaron$

what result do you expect? What is the error message actually seen?

obviously it has been downloaded to the project, but there are package.json, node_modules, package-lock.json
in the project, but not found?
in the terminal

Nov.04,2021

. / node_modules/.bin/webpack-v

or

npx webpack-v

npx is automatically installed in higher versions of npm (forget which version), and may have side effects (if not installed locally, it seems that it will automatically install global

< hr >

the reason is that. / node_modules/.bin is not added to PATH , and the command cannot be found. It can only be found by starting it in npm or starting with npx (scripts can be defined in npm to start)


is the environment variable profile set for the linux system?

Menu