Cannot find module 'lws/lib/usage'
See original GitHub issueI am using lws for mocking some API endpoints and everything worked fine until I’ve removed node_modules and ran npm install
again.
Now starting the server (ws -c mock-server/lws.config.js
) throws this error:
Error: Cannot find module 'lws/lib/usage'
at Function.Module._resolveFilename (module.js:555:15)
at Function.Module._load (module.js:482:25)
at Module.require (module.js:604:17)
at require (internal/module.js:11:18)
at MockResponse.middleware (...\node_modules\lws-mock-response\index.js:42:21)
...
The configuration file (mock-server/lws.config.js
) is very small :
module.exports = {
port: 8789,
mocks: require('./mocks')
};
where mocks.js exports a lambda following the pattern from the documentation:
module.exports = MockBase => class MockService extends MockBase {
mocks(options) {
return [...]; // several route configurations
}
};
I’ve looked in node_modules/lws/lib and indeed there is no usage.js file.
Am I missing something here or is it a regression from the lws-mock-response module?
Issue Analytics
- State:
- Created 5 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How do I resolve "Cannot find module" error using Node.js?
Using npm install installs the module into the current directory only (in a subdirectory called node_modules ). Is app.js located under ...
Read more >Fix Global Installs Not Working | "Cannot find module" error FIX
Getting " Cannot find module " after installing something globally (with -g)? Well, this video shows you how to fix global package/module ...
Read more >Solved: Cannot find module react : npm install - YouTube
Solved: Cannot find module react : npm install. 59K views 3 years ago React · CodeDocu Developer C# Asp Net Angular.
Read more >Error: Cannot find module 'express' - YouTube
Error: Cannot find module 'express'Error: Cannot find module 'cors'Error: Cannot find module 'body-parser'Error: Cannot find module ...
Read more >require.resolve "Error: Cannot find module" but ... - Reddit
this is all I'm trying to do require.resolve("stream-browserify") but I get a module not found error even though I can see it exists...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@tylermassey If a project is for some reason locked to version 2.5.2, a workaround would be to manually add a dependency to “lws” version 1.2.6 in order to prevent that issue from happening.
I’ve reinstalled and everything works fine now. Thank you very much for the quick response and fix!