npm list --global --depth 0
npm install npm@latest -g
node_modules
that are extraneous packages (that are not listed in package.json
)npm prune
Before running the above command, npm list --depth 0
showed several packages as extraneous.
Extraneous are packages that are not listed in dependencies
or devDependencies
but installed in node_modules
)+-- gulp@4.0.2 extraneous
+-- gulp-sass@4.1.0 extraneous
`-- moment@2.27.0
npm install / npm i
Shows current version of npm
npm --version / npm -v
Creates package.json
file with default valuesnpm init --yes / npm init -y
Installs package moment
npm install moment --save / npm i moment -S
Installs package lodash
for dev environment
npm install lodash --save-dev / npm i moment -D
Installs package live-server
globally so that other apps can use itnpm install --global live-server / npm i -g live-server
Other shortcuts - https://docs.npmjs.com/misc/configlive-server
did not work
browserify
did not work
The problem solved after running this command in Windows PowerShell
(open as an administrator)Set-ExecutionPolicy -Scope "CurrentUser" -ExecutionPolicy "Unrestricted"
npm install -g browserify
If our app main JS file is app.js, then running the command will create one bundle.js
filebrowserify app.js > bundle.js
npm install -g live-server
After installing, the package should be started by running the command in consolelive-server
composer.json
composer init