Ask coding questions

← Back to all posts
NPM Globally install a package
mamamia5x

I need to globally install a package for a program, but repl.it always returns an error. Why is that and how can I fix it?

Voters
subtra3t
mamamia5x
Comments
hotnewtop
mamamia5x
Coder100

does it work @mamamia5x

mamamia5x

Sorry was gone, but yes it actually works. @Coder100

Coder100

Of course not, installing it globally means installing it for everyone. That's not good and can be abused, so just remove the -g flag and use it normally.

SixBeeps

@Coder100 Uhh would it? Don't the runners do stuff in individual VMs?

mamamia5x

I need to run this command nearleyc grammar.ne -o grammar.js
but the commands needs the globally installed nearley
@Coder100

Coder100

@mamamia5x no not at all

Coder100

global = local folder but for all folders @mamamia5x

Coder100

what you are looking for is probs npx:
npx nearleyc grammar.ne -o grammar.js
it executes the package instead
@mamamia5x

SixBeeps

Mind telling us what package and what error you're getting?

mamamia5x

I'm installing Nearley JS
https://nearley.js.org/
I'm running npm install -g nearley
and getting the access error (EACCES) @SixBeeps