Search code examples
angularyarnpkgangular-universal

Cannot find module 'yarn' even though Yarn is installed


I am trying to run the starter kit of universal from this link: https://github.com/ng-seed/universal and even though I have followed the steps and installed Yarn, when I run the command to run the server, it gives me the following error:

Error: Cannot find module 'yarn' at Function.Module._resolveFilename (module.js:469:15) at Function.resolve (internal/module.js:27:19) at DllBundlesControl.getPackageJsonPath (/home/themadhatter/sites/brandyd-relaunch/node_modules/src/DllBundlesControl.ts:237:39) at DllBundlesControl.getPackageJson (/home/themadhatter/sites/brandyd-relaunch/node_modules/src/DllBundlesControl.ts:224:32)

. . .

When I run the command 'yarn' in my directory, it gives me the following message: yarn install v1.0.2 [1/4] Resolving packages... success Already up-to-date. Done in 2.10s.

I tried Googling and there are errors of missing other packages, but no errors of yarn itself missing. I can see where the module is missing in the error, but I can't seem to understand why it is not able to recursively get to the yarn module even though it's installed.


Solution

  • Make sure you install yarn by doing npm install yarn -g - this will install yarn globally on your machine, failing that you can use npm to install the packages by doing npm install, this will have the same effect as doing yarn install.