4

I need to run the following command:

$ npx cubejs-cli create <project name> -d <database type>

I have installed node.Js on my windows machine.

I launch the c:\nodejs\node.exe and a console windows opens up.

I paste the command in the command line like this:

> $ npx cubejs-cli create trafficninja -d mssql

Unfortunately this does not work and I get an error:

Uncaught SyntaxError: Unexpected identifier
    $ npx cubejs-cli create trafficninja -d mssql
      ^^^ 

Can someone advise how can I fix this issue?

3
  • npx is available with npm5.2+ check npm or node version Nov 17, 2021 at 19:23
  • @TusharMistry I just installed the latest version of node, do you think that something was not enough?
    – realPro
    Nov 17, 2021 at 19:38
  • Note that the $ in tutorials denotes a shell prompt. It's not supposed to be copied verbatim, it means that the following command (without $) is to be run in a shell, in particular a bash-like Linux shell like Git Bash (although this command works in cmd too).
    – CherryDT
    Nov 17, 2021 at 19:53

1 Answer 1

2

npx is a feature with node that runs separate from the actual node executable.

So to solve your issue, open a normal command prompt window. Type the following

npx --v

Be sure you don't run this command after opening the node.exe executable CLI. Run it in a fresh command prompt window.

This will tell you if npx is intalled, and if so, what version you are running.

If you're still seeing the npx isn't recognized, navigate to the nodejs installation, typicall here:

C:\Program Files\nodejs

You should see a file called npx inside.

From here, copy the path and change directory in the console to this location with the following command:

cd C:\Program Files\nodejs

After that, type the npx commmand:

npx --v

If this works, then your installation is good, but for some reason the environment variables didn't assign during installation.

4
  • @realPro Then the problem is your environment variables not being populated for some reason. Please see edits to my answer. Nov 17, 2021 at 19:47
  • As @CherryDT stated, restarting your machine may fix the environment variables. Nov 17, 2021 at 19:52
  • My mistake, I run the ver command on my local PC instead of the AWS VM.
    – realPro
    Nov 17, 2021 at 19:53
  • @realPro Node is amazing, stick with it my friend! You'll learn to love it. Nov 17, 2021 at 19:57

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.