You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何非全局安装ember-cli 1.13.11?以及nvm配置Node.js v4.0.0后本地安装ember-cli@4.0.0命令无法识别的问题求助

Hey there! Let's break down solutions for both your ember-cli questions clearly:

非全局安装ember-cli 1.13.11的方法

If you don't want to install ember-cli globally and keep it tied to your project, follow these steps:

  • First, navigate to your project folder (create one if you haven't yet with mkdir my-ember-project && cd my-ember-project)
  • Run the local install command:
    npm install ember-cli@1.13.11 --save-dev
    
    The --save-dev flag adds ember-cli to your project's package.json as a development dependency, making it easy to share or replicate the environment later.
  • To run ember commands, you can't just type ember directly (since it's not in your system PATH). Instead, use one of these options:
    1. Call the local executable directly:
      • On Windows: .\node_modules\.bin\ember <your-command> (e.g., .\node_modules\.bin\ember init)
      • On macOS/Linux: ./node_modules/.bin/ember <your-command>
    2. Use npm scripts:
      Add a script to your package.json:
      "scripts": {
        "ember": "ember"
      }
      
      Then run commands like npm run ember init or npm run ember serve
解决"ember is not recognized"的问题

The error happens because you installed ember-cli locally (without the -g flag), so the ember command isn't registered in your system's PATH. Here's how to fix it, tailored to your nvm setup:

First, confirm the local install worked: Check that there's an ember-cli folder in your project's node_modules, and an ember executable in node_modules/.bin.

Then pick one of these solutions:

  • Option 1: Run the local executable directly
    In your project folder, run:
    # Windows
    .\node_modules\.bin\ember -v
    # macOS/Linux
    ./node_modules/.bin/ember -v
    
  • Option 2: Use npm scripts (cleanest for project-specific commands)
    Add this to your package.json:
    "scripts": {
      "ember": "ember"
    }
    
    Now you can run npm run ember -v to check the version, or any other ember command like npm run ember build.
  • Option 3: Install ember-cli globally in your nvm environment
    If you want to use ember directly from the terminal in this node version, run:
    npm install -g ember-cli@4.0.0
    
    NVM manages global packages per node version, so this will only add the ember command to your current v4.0.0 environment—switching to another node version won't include it unless you install it there too.

内容的提问来源于stack exchange,提问作者Raja R

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.04.30 17:47:45