nodejs前缀-g不被识别为内部或外部命令,

时间:2017-07-02 07:36:10

标签: node.js cmd npm ionic2

我尝试使用nodejs和npm命令(设置了环境变量)并且我得到了这些错误;运行npm之后:

'CALL "E:\Program Files\nodejs\\node.exe" "E:\Program Files\nodejs\\node_modules\npm\bin\npm-cli.js" prefix -g' is not recognized as an internal or external command,
operable program or batch file.

Usage: npm <command>

where <command> is one of:
    access, adduser, bin, bugs, c, cache, completion, config,
    ddp, dedupe, deprecate, dist-tag, docs, edit, explore, get,
    help, help-search, i, init, install, install-test, it, link,
    list, ln, login, logout, ls, outdated, owner, pack, ping,
    prefix, prune, publish, rb, rebuild, repo, restart, root,
    run, run-script, s, se, search, set, shrinkwrap, star,
    stars, start, stop, t, tag, team, test, tst, un, uninstall,
    unpublish, unstar, up, update, v, version, view, whoami

npm <cmd> -h     quick help on <cmd>
npm -l           display full usage info
npm help <term>  search for help on <term>
npm help npm     involved overview

Specify configs in the ini-formatted file:
    C:\Users\Mohsen\.npmrc
or on the command line via: npm <command> --key value
Config info can be viewed via: npm help config

npm@3.10.10 E:\Program Files\nodejs\node_modules\npm

运行离子后启动newproject:

C:\Users\Mohsen\Desktop>ionic start test
? What starter would you like to use: blank
✔ Creating directory .\test - done!
[INFO] Fetching app base (https://github.com/ionic-team/ionic2-app-base/archive/master.tar.gz)
✔ Downloading - done!
[INFO] Fetching starter template blank (https://github.com/ionic-team/ionic2-starter-blank/archive/master.tar.gz)
✔ Downloading - done!
✔ Updating package.json with app details - done!
✔ Creating configuration file ionic.config.json - done!
[INFO] Installing dependencies may take several minutes!
> npm install
✖ Running command - failed!
[ERROR] Command not found: npm

问题是什么?

1 个答案:

答案 0 :(得分:1)

现在解决了。它不是nodejs PATH的错误。但是我的一个名为ComSpec的环境变量有多个值,它只允许一个