以前安装过node,现在安装n,找不以前的node

来源:15-5 NodeJs 的版本管理工具

慕姐2849259

2023-07-17

老师好,以前我的mac安装过node,现在安装n也成功了,但是执行n时报错:

find: /usr/local/n/versions: No such file or directory

Usage: n [options] [COMMAND] [args]

Commands:

  n                              Display downloaded Node.js versions and install selection
  n latest                       Install the latest Node.js release (downloading if necessary)
  n lts                          Install the latest LTS Node.js release (downloading if necessary)
  n <version>                    Install Node.js <version> (downloading if necessary)
  n install <version>            Install Node.js <version> (downloading if necessary)
  n run <version> [args ...]     Execute downloaded Node.js <version> with [args ...]
  n which <version>              Output path for downloaded node <version>
  n exec <vers> <cmd> [args...]  Execute command with modified PATH, so downloaded node <version> and npm first
  n rm <version ...>             Remove the given downloaded version(s)
  n prune                        Remove all downloaded versions except the installed version
  n --latest                     Output the latest Node.js version available
  n --lts                        Output the latest LTS Node.js version available
  n ls                           Output downloaded versions
  n ls-remote [version]          Output matching versions available for download
  n uninstall                    Remove the installed Node.js

Options:

  -V, --version         Output version of n
  -h, --help            Display help information
  -p, --preserve        Preserve npm and npx during install of Node.js
  -q, --quiet           Disable curl output. Disable log messages processing "auto" and "engine" labels.
  -d, --download        Download if necessary, and don't make active
  -a, --arch            Override system architecture
  --all                 ls-remote displays all matches instead of last 20
  --insecure            Turn off certificate checking for https requests (may be needed from behind a proxy server)
  --use-xz/--no-use-xz  Override automatic detection of xz support and enable/disable use of xz compressed node downloads.

Aliases:

  install: i
  latest: current
  ls: list
  lsr: ls-remote
  lts: stable
  rm: -
  run: use, as
  which: bin

Versions:

  Numeric version numbers can be complete or incomplete, with an optional leading 'v'.
  Versions can also be specified by label, or codename,
  and other downloadable releases by <remote-folder>/<version>

    4.9.1, 8, v6.1    Numeric versions
    lts               Newest Long Term Support official release
    latest, current   Newest official release
    auto              Read version from file: .n-node-version, .node-version, .nvmrc, or package.json
    engine            Read version from package.json
    boron, carbon     Codenames for release streams
    lts_latest        Node.js support aliases

    and nightly, rc/10 et al


  Error: no downloaded versions yet, see above help for commands

我现在是不是要卸载我的node版本,用n重新安装不同的node版本?

写回答

1回答

coder_monkey

2023-07-17

是否是 npm install -g n ?
目前是否有 nodeJs 版本?
尝试使用管理员权限运行 如: sudo n
如需设置可以参考 https://github.com/tj/n

0
2
coder_monkey
回复
慕姐2849259
这个就是需要sudo权限的哈 如果没有配置的话 每次在操作时加上 sudo 就好了哈 基本上目前的应该大于14.17 跑起来应该没有问题的哈
2023-07-17
共2条回复

Vue3+Uni+Node+MySQL 从零实现跨端小程序的全栈应用

小程序、 Vue3、Uni、NodeJs,全新300+技术点,实现跨端全栈应用

274 学习 · 155 问题

查看课程