I had this issue using live-server
(using the Fullstack React book):
I kept getting:
Error: Cannot find module './disable-browser-cache.js' ...
I had to tweak my package.json
From:
"scripts": { ... "server": "live-server public --host=localhost --port=3000 --middleware=./disable-browser-cache.js" ... } "scripts": {
To:
... "server": "live-server public --host=localhost --port=3000 --middleware=../../disable-browser-cache.js" ... }
Notice relative paths seem broken/awkward... ./
becomes ../../
I found the issue here
Also if anyone follows along with that book:
- change devDependencies in packages.json to:
"live-server": "https://github.com/tapio/live-server/tarball/master"
Currently that upgrades from v1.2.0 to v1.2.1
- It's good to use nvm.
- It's best to install v13.14 of Node (*v14+ creates other headaches)
nvm install v13.14.0
nvm alias default v13.14.0
- Update npm with
npm i -g [email protected]
- run:
npm update
- you can use
npm list
to see the hierarchy of dependencies too. (For some reason node 15 + latest npm defaults to only showing first level of depth - a la package.json. That renders default command pointless! You can append--depth=n
) to make command more useful again). - you can use
npm audit
too. There issues requiring (update ofchokidar
and some others packages) to newer versions.live-server
hasn't been updated to support the newer corresponding node v 14 library versions.
See similar post here
Footnote: Another thing when you get to the JSX section, check out my answer here: https://stackoverflow.com/a/65430910/495157
When you get to:
- Advanced Component Configuration with props, state, and children. P182+, node version 13 isn't supported for some of the dependencies there.
- Will add findings for that later too.