[SOLVED] "meteor npm install" putting files in weird place after migration to 1.3


#1

I’m trying to migrate my angular-meteor project from Meteor 1.2 to Meteor 1.3. However, it has been challenging. I have tried to rebuild the project on a clean Meteor 1.3 starter, and also to upgrade the existing project. Right now I’m trying to upgrade the existing project again.

Upgrading existing project to 1.3 seems to be problematic, because “meteor npm install” stores node_modules in my home directory, and I really don’t know why.

(tom @ 192.168.1.36)-(~/Github/my-upgraded-app/client) (master) $ meteor npm install --save angular angular-meteor angular-meteor-auth angular-sanitize angular-animate angular-ui-router ionic-sdk angular-sanitize@1.5.5 ../../../node_modules/angular-sanitize angular-meteor-auth@1.0.3 ../../../node_modules/angular-meteor-auth angular-animate@1.5.5 ../../../node_modules/angular-animate angular-ui-router@0.3.0 ../../../node_modules/angular-ui-router angular@1.5.5 ../../../node_modules/angular angular-meteor@1.3.11 ../../../node_modules/angular-meteor ionic-sdk@1.2.4 ../../../node_modules/ionic-sdk

In a fresh project the similar command (with all those packages already installed) gives completely different output.

(tom @ 192.168.1.36)-(~/Github/my-fresh-app/client) (master) $ meteor npm install --save angular angular-meteor angular-meteor-auth angular-sanitize ../angular-animate angular-ui-router ionic-sdk angular-sanitize@1.5.5 ../node_modules/angular-sanitize angular-meteor-auth@1.0.3 ../node_modules/angular-meteor-auth angular-animate@1.5.5 ../node_modules/angular-animate angular-ui-router@0.3.0 ../node_modules/angular-ui-router angular@1.5.5 ../node_modules/angular angular-meteor@1.3.11 ../node_modules/angular-meteor ├── underscore@1.8.3 └── jsondiffpatch@0.1.43 (chalk@0.5.1) ionic-sdk@1.2.4 ../node_modules/ionic-sdk

And this is the error message in my browser console, which caused me to dig this thing deeper.

`WARNING: npm peer requirements not installed:

So any ideas, how to fix wrong installation path for “meteor npm install” after migration?


#2

Check out the Folders - More Information section of the npm docs for a breakdown of what’s likely happening. Npm is looking in your current directory (~/Github/my-upgraded-app/client) for either a node_modules directory or a package.json file, then since it can’t find either one is walking up the folder tree. It will do this until it can find a node_modules or package.json file (and if it can’t will create node_modules in the current dir), which in your case it’s finding in your home directory. To force it to find the right node_modules directory, mkdir an empty node_modules directory where you want it, or create a default package.json manually (so for example create the node_modules or package.json in your ~/Github/my-upgraded-app directory).


#3

Shouldn’t you only have to do meteor update to an existing project to update it to 1.3? You don’t have to move to imports or change the folder structure right away. I did this with several existing apps and had no trouble with backwards compatibility.


#4

@nolapete: Apparently my app got broken. :smiley:

@hwillson: Thanks! Adding package.json file solved this problem.


#5

Yeah you didn’t run meteor npm install. That initializes package.json as
part of what it does. That would have taken care of it.


#6

@nolapete: Makes sense.