Meteor npm install --save iron:router

Hello, I am trying make iron:router work with my meteor, as I install iron:router with meteor install iron:router and do

import { Router } from 'iron:router';

my system warns me

Unable to resolve some modules:

  "iron:router" in /home/vinicius/Documents/cda/imports/startup/router.js (web.browser)
                                              
If you notice problems related to these missing modules, consider running:
                                              
  meteor npm install --save iron:router       
                                              
=> Started your app.                          
                                            

as I input this command I get the following error message

npm ERR! Unsupported URL Type: iron:router

how can I install iron router with es2015 modules.

Try using meteor add iron:router instead of meteor install iron:router

it is already installed, I’ve checked inside my .meteor/packages list

Does it work if you remove the import statement?

oddly it did, just messed up my eslint but it worked, thanks

Since iron router is a meteor package, you’d have to do this:

import { Router } from 'meteor/iron:router';

Notice the meteor/ part in front of iron:router. That tells the import system that you are trying to import a Meteor package, as opposed to an NPM package. Since your original import was missing that, the system assumed you wanted an NPM package, saw that the package was missing, and then suggested installing the missing package via NPM.

2 Likes

wow that really solved the problem! Thanks!