screepers / screeps-typescript-starter

Starter kit for TypeScript-based Screeps AI codes.
https://screepers.gitbook.io/screeps-typescript-starter/
The Unlicense
440 stars 315 forks source link

rollup (still) not working - cannot find module 'node:process' #172

Open Octaeon opened 1 year ago

Octaeon commented 1 year ago

I downloaded the packaged repository, unpackaged it, installed nodejs and npm through nvm (latest stable version of nodejs 12), installed rollup, ran the command npm install in the directory where I unpackaged the repo, ran rollup -c, and I get this error message:

node:internal/modules/cjs/loader:927
  throw err;
  ^

Error: Cannot find module 'node:process'
Require stack:
- C:\Users\av3st\.nvm\versions\node\v15.14.0\bin\node_modules\rollup\dist\bin\rollup
    at Function.Module._resolveFilename (node:internal/modules/cjs/loader:924:15)
    at Function.Module._load (node:internal/modules/cjs/loader:769:27)
    at Module.require (node:internal/modules/cjs/loader:996:19)
    at require (node:internal/modules/cjs/helpers:92:18)
    at Module.<anonymous> (C:\Users\av3st\.nvm\versions\node\v15.14.0\bin\node_modules\rollup\dist\bin\rollup:16:19)
    at Module._compile (node:internal/modules/cjs/loader:1092:14)
    at Object.Module._extensions..js (node:internal/modules/cjs/loader:1121:10)
    at Module.load (node:internal/modules/cjs/loader:972:32)
    at Function.Module._load (node:internal/modules/cjs/loader:813:14)
    at Function.executeUserEntryPoint [as runMain] (node:internal/modules/run_main:76:12) {
  code: 'MODULE_NOT_FOUND',
  requireStack: [
    'C:\\Users\\av3st\\.nvm\\versions\\node\\v15.14.0\\bin\\node_modules\\rollup\\dist\\bin\\rollup'
  ]
}

I tried searching for this error, but all I got from stackOverflow is that I should try and change the NodeJS version. I can't say I've done everything I can because honestly, I'm quite tired at this point, so I'll just ask people who are more experienced than me (I haven't written anything with NodeJS in my life and I'm just using it to try and code Screeps in TypeScript because I despise JavaScript).

Sorry if I came off rude, I really am quite tired and cranky. Thanks in advance for any ideas.

HenryClones commented 1 year ago

The command given to install RollUp in the README installs the latest version, which uses syntax incompatible with Node 12.x. I would recommend installing an older version of RollUp for now, such as sudo npm install -g rollup@2.77.2, or whichever version that as of time of writing is a year old, since Node 12.x's latest release was in 2022.