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

ember-cli 2.16.2下使用ember-browserify导入bpmn-js模块报错

Fixing "Could not find module npm:bpmn-js" in Ember CLI 2.16.2

Hey there, let's work through this module not found error you're hitting. I've dealt with similar issues using older Ember CLI versions and ember-browserify, so here's a step-by-step breakdown to get things working:

1. Install the compatible ember-browserify version

Ember CLI 2.16.2 doesn't play nicely with the latest ember-browserify releases (which target newer Ember versions). You'll need to stick to the 1.x branch for compatibility:

# Uninstall any existing ember-browserify first
npm uninstall ember-browserify --save-dev

# Install the version that works with Ember CLI 2.16.2
npm install ember-browserify@1.2.0 --save-dev

2. Double-check your bpmn dependencies are installed correctly

Make sure you've added bpmn-js and bpmn-js-properties-panel as regular project dependencies (not dev dependencies):

npm install bpmn-js bpmn-js-properties-panel --save

Wait for the install to finish, and confirm there are no errors in your terminal output.

3. Fix your import statement in the route

Older ember-browserify versions can struggle with importing entire libraries directly. Instead, import the specific class you need from bpmn-js (like Modeler, the most common use case):

// In app/routes/hello.js
import Ember from 'ember';
import BpmnModeler from 'npm:bpmn-js/lib/Modeler';

export default Ember.Route.extend({
  init() {
    this._super(...arguments);
    // Example usage to test the import
    const modeler = new BpmnModeler({ container: '#canvas' });
    // ... rest of your route logic
  }
});

If you need other components (like the Viewer), adjust the import path to match (e.g., npm:bpmn-js/lib/Viewer).

4. Clear Ember's cache and restart the dev server

Older Ember versions often hold onto stale cache that breaks module resolution. Do this to refresh things:

# Clear Ember's built-in cache
ember clear

# If that doesn't work, manually delete the tmp folder
rm -rf tmp/

# Restart your development server
ember serve

5. Verify your dependency setup

Check your package.json to confirm:

  • ember-browserify is listed under devDependencies with version ^1.2.0
  • bpmn-js and bpmn-js-properties-panel are in the dependencies section (not devDependencies)

If you still run into issues, double-check for typos in your import path, and ensure the node_modules/bpmn-js folder exists (if not, re-run npm install to re-install dependencies).

内容的提问来源于stack exchange,提问作者Srinath Prabhu

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.05.27 03:40:18