Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide better message during pulumi new if npm (or equivalent tools for other languages) isn't installed #13542

Open
justinvp opened this issue Jul 20, 2023 · 2 comments · May be fixed by #16096
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec

Comments

@justinvp
Copy link
Member

What happened?

If you don't have a required tool like npm installed, and you run pulumi new typescript, it will attempt to run npm install and fail because npm isn't available. At this point you have a partially initialized project, and it's unclear what you're supposed to do to address the problem. If you run pulumi new again, it'll error about existing files in the directory and can error about conflicting names (because the stack was already previously created).

Expected Behavior

At a minimum, when a required tool isn't available (e.g. npm isn't on PATH) we should emit a better message to the user. It doesn't even have to necessarily be an error. It could just be something along the lines of "your project has been created but needs to have dependencies installed. Install npm and then run npm install in this directory".

Steps to reproduce

Run on a machine that doesn't have npm installed, or as follows:

$ PATH="" /Users/user/.pulumi-dev/bin/pulumi new typescript
This command will walk you through creating a new Pulumi project.

Enter a value or leave blank to accept the (default), and press <ENTER>.
Press ^C at any time to quit.

project name: (myproject)
project description: (A minimal TypeScript Pulumi program)
Created project 'myproject'

Please enter your desired stack name.
To create a stack in an organization, use the format <org-name>/<stack-name> (e.g. `acmecorp/dev`).
stack name: (dev)
Created stack 'dev'

Installing dependencies...

error: installing dependencies failed; rerun manually to try again, then run `pulumi up` to perform an initial deployment: npm install failed: could not find npm on the $PATH; npm is installed with Node.js available at https://nodejs.org/: exec: "npm": executable file not found in $PATH

Output of pulumi about

$ pulumi about
CLI
Version      3.75.1-dev.0
Go Version   go1.20.5
Go Compiler  gc

Host
OS       darwin
Version  12.6.6
Arch     arm64

Additional context

No response

Contributing

Vote on this issue by adding a 👍 reaction.
To contribute a fix for this issue, leave a comment (and link to your pull request, if you've opened one already).

@justinvp justinvp added kind/bug Some behavior is incorrect or out of spec area/cli UX of using the CLI (args, output, logs) labels Jul 20, 2023
@nayanad
Copy link

nayanad commented Dec 24, 2023

Here issue occurred because Node/NPM is not installed, below are steps to install NPM and set $PATH

Download NPM from official site - https://nodejs.org/en/download

verify node.js install by command : node -v

Set Node home in Environment variable ->

run the below command to add the details in .bash_profile file permanently.
echo 'export PATH=/usr/local/bin:$PATH' >>~/.bash\_profile

Run below command to make it available for all users in the system
source ~/.bashrc

Now try to create Pulumi project :)

@Frassle
Copy link
Member

Frassle commented Dec 24, 2023

error: installing dependencies failed; rerun manually to try again,

We could probably just change this error message to say run pulumi install now that command exists.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/cli UX of using the CLI (args, output, logs) kind/bug Some behavior is incorrect or out of spec
Projects
None yet
3 participants