![]() If I run applications in fork mode they start in separate processes and nvm settings are in effect. So the main pm2 daemon starts with Node.js 6. So, the default setup is that the pm2 process starts when nvm is not in effect, so it uses the apt-get installation of Node.js (version 6). The reason was the following: We use nvm since we're running two apps on a server, one requires Node.js 5.6 because it uses node-gd (which doesn't run on Node.js 6 for now), the other requires Node.js 6. If you use nvm, check that existing node_modules that are bindings to other libraries are compiled for the correct Node.js version. ![]() Hopefully it's clear now that if you have production code, you can't rely on NPM actually maintaining your dependencies for you. A few days ago, somebody unpublished all of their packages ( ) ( archived on Wayback Machine) which broke React, Babel, and just about everything else. I've received a lot of flak for my response, specifically that I check in the packages that my code depends on. To install packages from package-lock.json instead of package.json use the command npm ci. Therefore you can leave out checking in packages, because the package-lock.json tracks the exact versions of your node_modules, you're currently using. Nowadays you can use package-lock.json file, which is automatically generated when npm modifies your node_modules directory. ![]() ![]() I usually install most packages locally so that they get checked in along with my project code. Is app.js located under home/dave/src/server/? If not and you want to use the module from any directory, you need to install it globally using npm install -g. Using npm install installs the module into the current directory only (in a subdirectory called node_modules). ![]()
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |