Confusion about installation of dependencies

When I create a new project using ‘au new’, all dependencies get installed as expected and I can run my application. However, not all dependencies seem to be included in package.json and when I manually change package.json and run ‘npm install’, a number of dependencies get uninstalled and ‘au run’ gives all kinds of errors.

How can I get the missing dependencies back without creating a new project? Am I supposed to be able to edit package.json in the first place or do I really need to go through ‘au import/install’?

It is not recommended to change the package.json manually. The installation of new plugins should be with the command: npm install xyx --save because there is a package-lock.json that is automatically generated for any operations where npm modifies either the node_modules tree, or package.json

The problem is that when you use npm install, it will remove any packages that are not in package.json, including a number of packages that aurelia needs to run.

Which version of node and aurelia-cli are you running at? Could you also give an example of a dependency you tried to install and which made your packages disappear after npm install?

I’m running npm 5.2.0 (I had to revert back from 5.5.1 due to a bug with installing some package) and aurelia-cli 0.32.0.

What I actually want to know, is what is the aurelia equivalent of npm install? Suppose I want to reinstall because I don’t keep my node_modules in version control, how do I do that?

If I run npm install, I miss all kind of aurelia packages, such as “aurelia-binding”, “aurelia-event-aggregator”, “aurelia-framework”, “aurelia-history”, “aurelia-history-browser”, etc.

For reference, this seems to be the problem I’m experiencing: https://github.com/aurelia/cli/issues/253

So it might be an npm issue. But then I don’t see why aurelia installs the packages correctly when creating a new project, while npm install does not.

It seems to work after upgrading npm to 5.6.0, removing the package-lock and node_modules and cleaning the npm cache.

I had the same problem.

My solution (probably not recommended) was to delete package-lock.json. The reason I did this was that I discovered that npm install was not updating to the latest aurelia packages.

I’ve been running like this for a couple of months on my current project and haven’t seen any problems so far.

Also, I always use au install and then try to work out what’s wrong from the auto-generated lines in aurelia.json!

Hi!

I am having the same problem, using aurelia-cli v0.32.0 and npm v5.6.0. I do the following:

  1. Create a new project with au new
  2. Install a node module with npm install <module> --save

npm then throws messages like:
npm WARN rm not removing <My development path>\node_modules\.bin\uuid.cmd as it wasn't installed by <My development path>\node_modules\node-uuid

And end up removing 1357 packages, thus breaking the Aurelia project.

Am I missing something?

I’m using a Windows 10 environment.