Module not found: Can't resolve 'module'
See original GitHub issueCan’t resolve ‘module’
When linking a dependency locally that uses module-alias
, I’m getting the error below:
Module not found: Can't resolve 'module' in '/Users/inje/Docs/repos/setprotocol.js/node_modules/module-alias'
How to Reproduce
- Have a locally cloned repo of your dependency and build your package.
- Run
yarn link
to create your symlinked package - In your depender repo, run
yarn link my-package-name
- In the depender repo, run your code
yarn start
Extra details
- The dependee library using
module-alias
is using typescript - The depender repo is a React app linking the dependee library locally. It’s also using typescript
Issue Analytics
- State:
- Created 5 years ago
- Reactions:15
- Comments:6 (1 by maintainers)
Top Results From Across the Web
Can't resolve module (not found) in React.js - Stack Overflow
It seems you need import Header from './components/header/header' w/o src. File path is relative to importing file path. Then you need to export ......
Read more >Module not found: Can't resolve 'X' error in React | bobbyhadz
To solve the "Module not found: Can't resolve" error in React, make sure to install the package from the error message if it's...
Read more >How to configure webpack to fix "Can't resolve 'module' from ...
I'm having a hard time to run babel-plugin-macros with a storybook, it seems I need to configure the webpack: I asked the same...
Read more >module-not-found - Next.js
Why This Error Occurred · The module you're trying to import is not installed in your dependencies · The module you're trying to...
Read more >cannot find module [Node npm Error Solved] - freeCodeCamp
How to Fix the "cannot find module" Error · delete the node modules folder by running rm -rf node_modules · delete package.lock.json file...
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
@Fensterbank Are you sure you are running it using Nodejs? Because some people have problems running it in Meteor or other environments.
I tried to create a simple file with
And calling it with
node ./test.js
worksOk I looked into it. It definitely works in pure Node, see proof of concept: https://github.com/Kehrlann/module-alias-yarn-link
No need for
module-alias
in a TypeScript project, you can use tsconfig’s paths, see: https://blog.joefallon.net/2018/02/using-short-imports-in-typescript/ … you app being React, it will very likely run through a Webpack step, which also have it’s own module-aliasing capabilities: https://webpack.js.org/configuration/resolve/ . I’m no suremodule-alias
is the right solution for you.