Preact-cli: Getting a command not found after global install on @2.1.1

Created on 7 Feb 2018  路  9Comments  路  Source: preactjs/preact-cli


What is the current behaviour?

After global installing I get a command not found.
My code is as follows:

$ npm install -g preact-cli@latest
npm WARN deprecated [email protected]: gulp-util is deprecated - replace it, following the guidelines at https://medium.com/gulpjs/gulp-util-ca3b1f9f9ac5
/Users/tfaller/.npm-packages/bin/preact -> /Users/tfaller/.npm-packages/lib/node_modules/preact-cli/lib/index.js

> [email protected] postinstall /Users/tfaller/.npm-packages/lib/node_modules/preact-cli
> node -p 'require("./check.js")()'

true
+ [email protected]
updated 1 package in 27.095s
$ preact create widget MDEditor
-bash: preact: command not found
$

I tried both preact-cli and preact-cli@latest but I get the same message
Any thoughts?

If the current behaviour is a bug, please provide the steps to reproduce.

Please mention other relevant information.

  • Node 9.4.0
  • npm 5.6.0
  • Operating system: Mac OS 10.13.3
  • CLI version: 2.1.1
  • Browser: Chrome 64

Most helpful comment

Thanks.

I added a new directory in my PATH using

export PATH=$PATH:~/.npm-packages/bin

And it seems to be working now, hope this was a good fix 馃憤

All 9 comments

I'm not seeing an open issue on this so I'm assuming it might be something on my end with my _PATH or something.
I've had issues with Home-brew in the past but it was working ok after I removed it.
Any help would still be vastly appreciated
馃槄

Yeah, seems like an issue with your path
is /Users/tfaller/.npm-packages and or /Users/tfaller/.npm-packages/lib in there?
not entirely sure how you have npm set up

Yeah, that's what I thought thanks @ForsakenHarmony
I tried pulling out the global path and it gave ne this:

$ npm config get prefix
/Users/tfaller/.npm-packages
$

Does that seems right? So the CLI is being installed in the lib sub-folder instead of on the main path?

you can check where the executable is located (for me it's in the npm folder, which contains node_modules) and then see if that folder is in your path

I'm not sure about the lib sub-folder, it doesn't happen on windows, but might on mac

Thanks.

I added a new directory in my PATH using

export PATH=$PATH:~/.npm-packages/bin

And it seems to be working now, hope this was a good fix 馃憤

Thanks.

I added a new directory in my PATH using

export PATH=$PATH:~/.npm-packages/bin

And it seems to be working now, hope this was a good fix 馃憤

I used this command with npm-global folder and works fine.
If anyone has this folder too, can use.

Thanks!

Thanks.

I added a new directory in my PATH using

export PATH=$PATH:~/.npm-packages/bin

And it seems to be working now, hope this was a good fix 馃憤

Sorry if commenting after it's closed isn't allowed - but where would you place this command? Is it on a file or do you run it in Terminal?

Hi @jsarge11. Run it on terminal. This command writes on bash file a PATH for bin folder of npm.

export PATH=$PATH:~/.npm-global/bin works for me.

Was this page helpful?
0 / 5 - 0 ratings