Failing to do a simple import

I’ve created a new app using meteor create.
I notice that already the meteor create command makes a 1.3 type of app, complete with the new import system and so on. Great, I want to make a start on that.

server/main.js (created automatically) is as follows:

import { Meteor } from 'meteor/meteor';

Meteor.startup(() => {
  // code to run on server at startup
});

I want to start using Restivus, so immediately below the {Meteor} import I add the following:

import { Restivus } from 'meteor/kahmali:meteor-restivus';

Starting the app now fails with the following message:

Error: Can’t find npm module ‘meteor/kahmali:meteor-restivus’. Did you forget to call ‘Npm.depends’ in package.js within the ‘modules-runtime’ package?

After a year of using Meteor I fail on the first line I add to my code in a new app.
Any help would be much appreciated.

Did you add the kahmali:meteor-restivus package to your app using meteor add?

I agree the message is really misleading since this doesn’t have to do with NPM. @benjamn we should probably detect the meteor/ prefix and warn about Atmosphere instead!

Er, no I didn’t.
Sorry, thought that the import did it all, of course it can’t.

Might be an idea however to also make it clear that you still have to do the meteor add, even if it seems obvious to the initiated

1 Like

I think it would be pretty sweet if Meteor detected a valid reference to a package that hasn’t been npm installed yet and just installed it for you when it starts. npm install x does feel a bit redundant if you also have to write import { Foo } from 'Bar' somewhere anyway.

1 Like

I also got the name wrong for the add.
This package uses a name for the add different to the folder and name in the file system.

It should be meteor add nimble:restivus

Sorry for the bother, though the problem with the message still stands.

It’s now working. Thank you for the blazingly fast help.

1 Like