沙滩星空的博客

nodejs

  • 查看官方的发布页,获取要安装的 Node.js 版本号: https://nodejs.org/en/download/releases
wget -c https://nodejs.org/dist/v24.14.0/node-v24.14.0-linux-x64.tar.xz
tar -xf node-v24.14.0-linux-x64.tar.xz
# 添加bin目录到PATH环境变量中

npm和npx

# npx 的设计中,--registry 等配置参数属于 npx 自身的全局参数,必须紧跟在 npx 命令之后,在目标命令之前指定。
npx --registry=https://registry.npmmirror.com create-react-app my-app

# 后期可以使用npx命令,启动前面安装的模块
npx n8n start

# npm install 的 --registry 是 npm 命令的配置参数,需放在子命令(install)之后
npm install -g create-react-app --registry=https://registry.npmmirror.com
  • npx 的参数是 前置修饰符(影响 npx 自身行为)。
  • npm install 的参数是 后置修饰符(影响 install 子命令的行为)

安装位置

# 查找缓存路径.这会返回类似 /Users/yourname/.npm
# C:\Users\yourname\AppData\Roaming\npm-cache 或
# C:\Users\yourname\AppData\Local\npm-cache
# npx安装路径:C:\Users\yourname\AppData\Local\npm-cache\_npx\a8a7eec953f1f314\node_modules\.bin
npm config get cache

# 如需固定路径,改用全局安装
npm install -g n8n

安装位置可通过以下命令查看:
npm list -g --depth=0 | grep n8n

切换Node版本

  • nvm.md
最近更新: 2026/3/9 14:37
Contributors: Hankin