简体   繁体   中英

How to run npx Node.Js command on windows

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM