Today I tried to learn more about Google Web Starter Kit so I followed these instructions and after a lot of fight and problem I just tried to start a local server (the first task we’ll look at is: $ gulp serve
.) and received this error:
C:\gwsk>gulp serve
Error: Cannot find module 'lodash'
at Function.Module._resolveFilename (module.js:338:15)
at Function.Module._load (module.js:280:25)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\gwsk\node_modules\browser-sync\node_modules\portsc
anner-plus\lib\index.js:3:9)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (C:\gwsk\node_modules\browser-sync\lib\utils.js:6:19)
Honestly I'm completely lost here, so any help is pretty welcome. I'm new to node.js, to gulp, I just wanted it to try GWSK but turn into a headache :(... I'm a web designer not developer....
I got the error above and after fixing it I got an error for lodash/merge, then I got an error for 'license-check-and-add' then I realized that according to https://accessibilityinsights.io if I ran the below command, it installs all the missing pacakages at once! Then running the yarn build command worked smoothly with a --force parameter with yarn build.
yarn install
yarn build --force
Reinstall 'browser-sync' :
rm -rf node_modules/browser-sync
npm install browser-sync --save
For me, I update node and npm to the latest version and it works.
Maybe loadash needs to be installed. Usually these things are handled by the package manager. On your command line:
npm install lodash
or maybe it needs to be globally installed
npm install -g lodash
If there is a package.json
, and in it there is lodash
configuration in it. then you should:
npm install
if in the package.json
there is no lodash
:
npm install --save-dev
I found deleting the contents of node_modules and performing npm install
again worked for me.
though npm install lodash
would work, I think that it's a quick solution but there is a possibility that there are other modules not correctly installed in browser-sync
.
lodash is part of browser-sync
. The best solution is the one provided by Saebyeok. Re-install browser-sync
and that should fix the problem.
The above error run the commend line\
please change the command $ node server it's working and server is started
Source: Stackoverflow.com