Launched Wappler this morning, and all of a sudden the majority of node_modules folders have dissappeared. The app still appears to be running fine, and the package.json file appears the same as our other project (Which has all the node_modules) folders.
Wondering what I should do here? I’ve tried installing node packages again, and updating them - and no change to this folder…
Ok, looks like the package-lock.json file lost all of it’s data, bar some of the modules I have installed myself from NPM. Any ideas if it’s safe to just clone from another project? @Teodor
In each of these, they have a long list of dependencies (module folders) in the node_modules folder, and in the package-lock.json file, they have all of these listed here.
All fo a sudden, this morning, the current and newest project’s node_modules folder is empty, bar the packages I’ve installed via npm and package-lock.json is empty, excluding those.
The concern I have, even though as you say this is just used for development - is if I deploy to prod, then it will clear out the packages as they are not in the folder/package-lock file.
Thanks @ben, yep I’ve done that - I’ve tried the update option, too. Doesn’t install the required packages (as per other projects) so I’m a little lost what’s happened, and the right way to solve it! @George?
If the node modules install command is all running fine and also your app, then there is nothing to worry about.
Dependenties of node modules might change that result in changes and removal of some packages but that is all ok.
This is how the NodeJS ecosystem works
Also as Ben pointed out - node_modules are installed again per target. So you might have one for your development- and a different set for your production.
It’s all done for you by node and it’s package manager npm.
Wappler just writes the packages it needs in the package.json and npm make sure they get installed.
When comparing against a new project created (for testing this issue) they do not exist in node_modules folder (local) and they do not exist in the package-lock.json file.
When I run install, or update node packages it runs fine without clear errors.
In the latest version of knex ( the generic database access library we use) they included updated the Node driver for me sql to use directly the native driver without the need of extra node wrapper library. And that reduced a lot of the dependencies.
So on new project you will have less node modules.
Older projects because they use package-lock.json - gets locked on the versions that have installed initially. To ensure compatibility.
Understood @George and please don’t think I don’t trust you, obviously I do implicitly - but this just feels very strange. All of the standard packages that come with a nodejs new install just don’t exist - I can’t underst why it would be ok that they are not there?
E.g. things like mime, mime-db, json-shema, json-schema-traverse, jsonwebtoken, base64, @babel - all things that I assume are needed - do not exist at all in the folder, or in package-lock.
For example, in your example above - I actually have dependencies/folders in node_module in a brand new project, than I do in the project where all of these have dissappeared.
All of my projects ( the three I mention are NodeJS Wappler projects, within Docker) - all are fully up to date with the latest Wappler version, and node packages. The only difference is one has 170 less packages in the node_modules folder and in the package-lock.json - and that’s the current project I opened this morning.
What else can I do to test/check before I start deploying to staging / prod again?