Skip to content

Instantly share code, notes, and snippets.

@bzerangue
Created June 12, 2019 15:44
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bzerangue/2846c8b8705962cb0ac733dccb86cc47 to your computer and use it in GitHub Desktop.
Save bzerangue/2846c8b8705962cb0ac733dccb86cc47 to your computer and use it in GitHub Desktop.
Error: Cannot find module './cors/addCorsOriginCommand'
Require stack:
- /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/eleventyboilerplate/node_modules/@sanity/core/lib/commands/index.js
- /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/eleventyboilerplate/node_modules/@sanity/core/lib/index.js
- /usr/local/lib/node_modules/@sanity/cli/bin/sanity-cli.js
- /usr/local/lib/node_modules/@sanity/cli/bin/sanity
at require (/usr/local/lib/node_modules/@sanity/cli/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
at Object.<anonymous> (~/Dev/sanity/eleventy-sanity-blog-boilerplate/eleventyboilerplate/node_modules/@sanity/core/lib/commands/index.js:64:52)
at Module._compile (/usr/local/lib/node_modules/@sanity/cli/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
sanitytutorialblog: Unhandled rejection: Error: Cannot find module './cors/addCorsOriginCommand'
sanitytutorialblog: at Function.Module._resolveFilename (internal/modules/cjs/loader.js:582:15)
sanitytutorialblog: at Function.Module._load (internal/modules/cjs/loader.js:508:25)
sanitytutorialblog: at Module.require (internal/modules/cjs/loader.js:637:17)
sanitytutorialblog: at require (/Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
sanitytutorialblog: at Object.<anonymous> (/Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio/node_modules/@sanity/core/lib/commands/index.js:64:52)
sanitytutorialblog: at Module._compile (/Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
sanitytutorialblog: at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
sanitytutorialblog: at Module.load (internal/modules/cjs/loader.js:600:32)
sanitytutorialblog: at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
sanitytutorialblog: at Function.Module._load (internal/modules/cjs/loader.js:531:3)
@bzerangue
Copy link
Author

error.txt - is if I do a simple sanity init

error2.txt - is if I following step #2 from the readme here, https://github.com/kmelve/eleventy-sanity-blog-boilerplate

@bzerangue
Copy link
Author

from knut (@kmelve) - "We believe it's a yarn cache problem. Try to delete node modules, yarn cache clean, yarn install"

@bzerangue
Copy link
Author

from knut (@kmelve) - "We believe it's a yarn cache problem. Try to delete node modules, yarn cache clean, yarn install"

That fixed step #2, from https://github.com/kmelve/eleventy-sanity-blog-boilerplate

Now, I get the following error when I run yarn run dev or npm run dev...

lerna notice cli v3.15.0
lerna info Executing command in 2 packages: "npm run dev"
sanitytutorialblog: > sanitytutorialblog@1.0.0 dev /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio
sanitytutorialblog: > sanity start
web: > web@1.0.0 dev /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/web
web: > npm run watch
web: > web@1.0.0 watch /Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/web
web: > npx eleventy --watch
sanitytutorialblog: Unhandled rejection: Error: Cannot find module './cors/addCorsOriginCommand'
sanitytutorialblog:     at Function.Module._resolveFilename (internal/modules/cjs/loader.js:636:15)
sanitytutorialblog:     at Function.Module._load (internal/modules/cjs/loader.js:562:25)
sanitytutorialblog:     at Module.require (internal/modules/cjs/loader.js:690:17)
sanitytutorialblog:     at require (/Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio/node_modules/v8-compile-cache/v8-compile-cache.js:161:20)
sanitytutorialblog:     at Object.<anonymous> (/Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio/node_modules/@sanity/core/lib/commands/index.js:64:52)
sanitytutorialblog:     at Module._compile (/Users/bmz/Dev/sanity/eleventy-sanity-blog-boilerplate/studio/node_modules/v8-compile-cache/v8-compile-cache.js:192:30)
sanitytutorialblog:     at Object.Module._extensions..js (internal/modules/cjs/loader.js:787:10)
sanitytutorialblog:     at Module.load (internal/modules/cjs/loader.js:653:32)
sanitytutorialblog:     at tryModuleLoad (internal/modules/cjs/loader.js:593:12)
sanitytutorialblog:     at Function.Module._load (internal/modules/cjs/loader.js:585:3)

@bzerangue
Copy link
Author

bzerangue commented Jun 12, 2019

GOT IT! I npm uninstalled @sanity/cli globally. Then ran yarn cache clean and now it works properly!!! Thanks for your help.

@kmelve
Copy link

kmelve commented Jun 13, 2019

So this is solved for your part now?

@bzerangue
Copy link
Author

@kmelve - No, the 'Error: Cannot find module './cors/addCorsOriginCommand' popped back up again. I don't understand what is triggering this. Now when I yarn cache clean, it doesn't do anything.

@bzerangue
Copy link
Author

bzerangue commented Jun 13, 2019

@kmelve - After completely removing the library cache on my mac and removing node, npm, yarn from my system. Then reinstalling node lts with n... I get the same error.

error

NOTE: I installed Node via n and installed node this way... curl -L https://git.io/n-install | bash and the installed the LTS version of node this way n lts

@rexxars
Copy link

rexxars commented Jun 13, 2019

I just released v0.140.33 - I'm hoping that'll somehow fix the issue?
We were not able to reproduce this error, but heard others having the same issue - would be great if you could give us a heads up if this solves it

@bzerangue
Copy link
Author

@rexxars - I am trying it now.

@bzerangue
Copy link
Author

@rexxars and @kmelve - it is working now. I removed and reinstalled node and installed sanity-cli globally... v0.140.34

@rm-rf-etc
Copy link

I have this problem too. I'm using node v11.11.0, which one are you on? I'm also using nvm.

@rm-rf-etc
Copy link

Problem solved. Needed to update yarn using brew upgrade yarn (was on 1.13.0, upgraded to 1.17.3). Seems the problem is that Node is a dependency of yarn and it was not current.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment