-
-
Notifications
You must be signed in to change notification settings - Fork 907
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module 'uuid/v4' #238
Comments
Hello DEK4, in a shell within your project source folder, could you run |
So great, it's a direct dependency of your project and that's the latest version. |
Also, try installing into a new, empty directory. This may be an issue with your project configuration.
|
The global install also doesn't work |
@dsouzadyn Are you trying to If you really want to require the global installed version, set your NODE_PATH property accordingly. |
No response from @anchnk. Closing |
Just ran into this issue on my computer, it was because I was using the newer version of the library than my code was written for. The original code was const uuidV4 = require('uuid/v4') Newer versions of this library requires it to be const { v4: uuidV4 } = require('uuid'); Hope this helps anyone else searching in the future 👍 |
The problem with this change is that it has greater weight when required.
|
@victorhcortes Not significant in node. Bundlers are able to treeshake unused modules. Though you have to use es modules syntax. Commonjs is not reliable and does not work in a lot of cases. |
FTFY. (... to clarify that CommonJS works fine as a whole. It's only when it comes to tree-shaking - unused code removal - that it becomes problematic.) @victorhcortes: As the person responsible for the previous incarnation of |
@TrySound By accumulating this cost with other dependencies you will know how heavy it can be. @broofa I understand the point that was necessary to maintain compatibility and avoid problems.
|
Right, I meant this in tree-shaking context.
Yes, I know. This is why the change was considered carefully. There is not cost for bundlers and it's not significant for node as reading from disk even large scripts is fast enough. Memory usage is a problem of script execution not the size. We have a lot of really bloated libraries like lodash which is used in three forms ( |
If code size is a primary consideration for people, there are options:
|
@corteshvictor thanks your solutions works for me |
Thanks people it solved my problem. |
Hi,
I install uuid module on my Windows 10 64bit with WebStorm and NodeJS 8.8.1 but when I require the module I get this error:
error: uncaughtException: Cannot find module 'uuid/v4'
Any idea?
Thanks
The text was updated successfully, but these errors were encountered: