Ask coding questions

← Back to all posts
AlbionBot
jenks59

i cannot figure out what im doing wrong as to getting this to work can anyone here help me out please

Voters
jenks59
Comments
hotnewtop
Stonkic

Hello, please remember to hide your discord bot token using environment variables or other methods, or else other people might steal them. I would also appreciate it if you could detail the problem, so I know what you need help to fix.

jenks59

@Stonkic so when i run it i get this > [email protected] start /home/runner/AlbionBot

http-server -a localhost -p 8000 -c-1

sh: http-server: command not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! [email protected] start: http-server -a localhost -p 8000 -c-1
npm ERR! spawn ENOENT
npm ERR!
npm ERR! Failed at the [email protected] start script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-10-28T08_43_03_417Z-debug.log
exit status 1

Stonkic

@jenks59 Hello, "sh: http-server: command not found" when you tried to run the start command it failed, as the package/command "http-server" is not installed. To fix this, click on the side panel button marked "Packages" and search for "http-server" and add it. This should resolve this issue.

jenks59

@Stonkic  npm install --global http-server
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! syscall access
npm ERR! path /usr/local/lib/node_modules
npm ERR! errno -13
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! [Error: EACCES: permission denied, access '/usr/local/lib/node_modules'] {
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules'
npm ERR! }
npm ERR!
npm ERR! The operation was rejected by your operating system.
npm ERR! It is likely you do not have the permissions to access this file as the current user
npm ERR!
npm ERR! If you believe this might be a permissions issue, please double-check the
npm ERR! permissions of the file and its containing directories, or try running
npm ERR! the command again as root/Administrator.

npm ERR! A complete log of this run can be found in:
npm ERR! /home/runner/.npm/_logs/2021-10-28T10_18_23_024Z-debug.log

Stonkic

@jenks59 Hello, the error originated by using the --global flag, as it requires root access to write to restricted folders. Did you install the package using replit's built-in package tool or through the shell?

jenks59

@Stonkic so the issue is not being able for the bot to be ran locally would you happen to know a fix for this?