customrealms / cli

Command line tools for creating and compiling JavaScript Minecraft plugins.
https://customrealms.io
MIT License
9 stars 3 forks source link

npm install -g @customrealms/cli #7

Closed gitFoxCode closed 1 year ago

gitFoxCode commented 1 year ago
npm ERR! code 1
npm ERR! path C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node postinstall.js install
npm ERR! Copying the relevant binary for your platform win32 (x64)
npm ERR! Error: Command failed: npm bin -g
npm ERR!
npm ERR!     at ChildProcess.exithandler (node:child_process:412:12)
npm ERR!     at ChildProcess.emit (node:events:513:28)
npm ERR!     at maybeClose (node:internal/child_process:1091:16)
npm ERR!     at Socket.<anonymous> (node:internal/child_process:449:11)
npm ERR!     at Socket.emit (node:events:513:28)
npm ERR!     at Pipe.<anonymous> (node:net:313:12) {
npm ERR!   code: 1,
npm ERR!   killed: false,
npm ERR!   signal: null,
npm ERR!   cmd: 'npm bin -g'
npm ERR! }
npm ERR! C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli\node_modules\mkdirp\lib\path-arg.js:20
npm ERR!       throw Object.assign(new Error('Illegal characters in path.'), {
npm ERR!                           ^
npm ERR!
npm ERR! Error: Illegal characters in path.
npm ERR!     at pathArg (C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli\node_modules\mkdirp\lib\path-arg.js:20:27)
npm ERR!     at mkdirp (C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli\node_modules\mkdirp\index.js:10:10)
npm ERR!     at getInstallationPath (C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli\postinstall.js:45:11)
npm ERR!     at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
npm ERR!     at async verifyAndPlaceBinary (C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli\postinstall.js:53:30)
npm ERR!     at async Object.install (C:\ProgramData\nvm\v18.12.1\node_modules\@customrealms\cli\postinstall.js:157:5) {
npm ERR!   path: 'C:\\ProgramData\\nvm\\v18.12.1\\node_modules\\@customrealms\\cli\\Unknown command: "bin"\n' +
npm ERR!     '\n' +
npm ERR!     'To see a list of supported npm commands, run:\n' +
npm ERR!     '  npm help',
npm ERR!   code: 'EINVAL'
npm ERR! }
npm ERR!
npm ERR! Node.js v18.12.1
TheGalacticAce commented 1 year ago

Hi, this issue is caused because now npm bin is deprecated. In order to fix this you will have to backtrack to npm v8. So you will have to run npm install -g npm@8.19.4. Then, you can install Custom Realm's CLI with npm install -g @customrealms/cli. After that, you will have to update back to the latest version of npm for best performance, so you will have to run npm update -g npm. Lastly, you might have to fix a few issues in packages, so just run npm audit fix to fix them. And bam! The CLI should work.

npm install npm@8.19.4
npm install @customrealms/cli
npm update -g npm
npm audit fix

This solved it for me. Hope this helps.

gitFoxCode commented 1 year ago

@TheGalacticAce Thanks for the reply, unfortunately after this error popped up for me I switched to grakkit which worked