Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

Game Development Game Development with Phaser Building a Platform Game with Phaser Project Setup Using Vite

Devontay Cross
Devontay Cross
11,104 Points

After following this video, I get an error every time I try to 'npm run dev'.

> platform_game2@0.0.0 dev
> vite

/Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js:87
                throw new Error(
                      ^

Error: Cannot find module @rollup/rollup-darwin-arm64. npm has a bug related to optional dependencies (https://github.com/npm/cli/issues/4828). Please try `npm i` again after removing both package-lock.json and node_modules directory.
    at requireWithFriendlyError (/Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js:87:9)
    at Object.<anonymous> (/Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js:96:76)
    ... 3 lines matching cause stack trace ...
    at Module._load (node:internal/modules/cjs/loader:938:12)
    at ModuleWrap.<anonymous> (node:internal/modules/esm/translators:165:29)
    at ModuleJob.run (node:internal/modules/esm/module_job:192:25)
    at async DefaultModuleLoader.import (node:internal/modules/esm/loader:228:24) {
  [cause]: Error: Cannot find module '@rollup/rollup-darwin-arm64'
  Require stack:
  - /Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js
      at Module._resolveFilename (node:internal/modules/cjs/loader:1048:15)
      at Module._load (node:internal/modules/cjs/loader:901:27)
      at Module.require (node:internal/modules/cjs/loader:1115:19)
      at require (node:internal/modules/helpers:130:18)
      at requireWithFriendlyError (/Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js:69:10)
      at Object.<anonymous> (/Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js:96:76)
      at Module._compile (node:internal/modules/cjs/loader:1233:14)
      at Module._extensions..js (node:internal/modules/cjs/loader:1287:10)
      at Module.load (node:internal/modules/cjs/loader:1091:32)
      at Module._load (node:internal/modules/cjs/loader:938:12) {
    code: 'MODULE_NOT_FOUND',
    requireStack: [
      '/Users/devontaycross/Documents/Documents - Devontay’s MacBook Air/Team Tree House/MeMo Game/platform_game/node_modules/rollup/dist/native.js'
    ]
  }
}

Node.js v20.5.1

1 Answer

Rohald van Merode
seal-mask
STAFF
.a{fill-rule:evenodd;}techdegree
Rohald van Merode
Treehouse Staff

Hi Devontay Cross 👋

I'm unable to replicate this issue on my end but have you tried the suggestion that is being provided in that error message?

Please try npm i again after removing both package-lock.json and node_modules directory.

This usually fixes there kind of errors 🙂

Hope this helps!

Devontay Cross
Devontay Cross
11,104 Points

Thanks for the suggestion, I had to completely redownload VSCode for everything to work correctly