I am working on Meteor and want to know that what is the difference between
npm install and meteor npm install.
Thanks
According to Meteor Development Group's comments in the official forum, the difference is as follows;
meteor npm calls the bundled npm version, so it doesn’t require npm to be installed globally, That is just a convenience however, so if you do have npm installed using that will work perfectly fine. That being said, it is a good practice to get into always using meteor npm, as that way you can make sure you’re using the same npm version that has been tested with your current version of Meteor.
When using meteor npm you can make sure that you are using the same npm version that has been tested with your current Meteor's version.
When using npm install it just uses the global npm on your machine. So i'd advise to use meteor npm
This may help you to understand difference between npm install and meteor npm install
The former is installing npm packages, which will be listed in packages.json and located in the node modules directory and need to be imported into your code.
The latter is using atmosphere packages which will be listed under .meteor/packages and will be included in your build (no need to import).
Related
I am looking for a way to upgrade my npm, I follow the option 3 for windows in here npm docs. but when I install it it said npm.exe already in nodejs folder. I try to overwrite it with --force but it still not overwritten. How to do it correctly? also how to update node?
This is the new best way to upgrade npm on Windows.
Run PowerShell as Administrator
Set-ExecutionPolicy Unrestricted -Scope CurrentUser -Force
npm install -g npm-windows-upgrade
npm-windows-upgrade
Note: Do not run npm i -g npm. Instead, use npm-windows-upgrade to update npm going forward. Also if you run the NodeJS installer, it will replace the node version.
Upgrades npm in-place, where node installed it.
Easy updating, update to the latest by running npm-windows-upgrade -p -v latest.
Does not modify the default path.
Does not change the default global package location.
Allows easy upgrades and downgrades.
Officially recommended by the NPM team.
A list of versions matched between NPM and NODE (https://nodejs.org/en/download/releases/) - but you will need to download NODE INSTALLER and run that to update node (https://nodejs.org/en/)
There is a tool, nvm, that solves your problem quite easly. There is also a Windows version, is not as cool as the linux/mac version but it works fine anyway
I suggest using option 1. Go to environment system variables and add "%appdata%\npm" to path like this: edit path
Then updated npm files should be loaded before those you installed with node
Node.js v16 or higher?
npm install -g npm
Node.js v14 or below?
Consider updating to latest LTS release of Node.js
npm-windows-upgrade
When I first started to learn Election the book I was using recommended that it be installed using npm install -g electron. Now I read on the npm website that npm install electron --save-dev is the preferred way to install it.
So I created a new project directory and ran npm init then ran
npm install electron --save-dev. According to package.json Electron 1.7.5 was installed, but when I type electron in the project directory it reports version 1.6.10 which is the version that was installed with the -g option.
Is there a way to get my new project to use 1.7.5? I have already completed a small project using version 1.6.10 and don't want to do anything that would keep it from running.
Thanks, Jim
You can run the local version of electron out of the node_modules/.bin directly -- most likely it will be called node_modules/.bin/electron.
You can use npm or gulp (or even a shellscript/batch file) to run the app for you.
I can not run the Angular 2 project.
What I tried:
- running the project by using npm install and npm start | does not work
- I cloned quickstart from the github and replaced with my src folder and I still get the "can not find module in #angular/core"
Here is the full console output: https://www.dropbox.com/s/5plmqrjd6ge0lta/error.txt?dl=0
Many people will come here. I have had the same problem. Do not panic. You are probaly following the tutorial of tutorialspoint.
Just install the core again using NPM
npm install #angular/core
There was/is a bug in certain versions of npm that causes installed modules to disappear when using npm install someModule ... or npm install someModule --save-dev
This was apparently an issue if the module being installed was from a GitHub repo and lacked a specific commit hash to reference for the installation. Although the issue was marked "closed" and the repo archived several months ago at v5.6.0, I ran into the problem today w/the latest npm 6.4.0
In my case, doing npm install rxjs completely removed the #angular/core module, along with my #ionic-native plugins, and anything else I'd installed individually (and then it failed to actually/properly install rxjs anyway!!)
Tip: copy your existing npm modules folder as a backup before starting updates or removing it entirely & trying to npm install.
You can manually install to your project via npm install #angular/core, but depending on the npm version (or the angle of the moon at that precise moment, who knows) be aware that you might wind up with other missing dependencies.
Also try npm install #angular/core && npm install ... Apparently the additional npm install helps replace the randomly deleted/missing modules in some cases.
Using private npm, common commands seem not to work:
npm install without a specific #version :: issue
npm outdated :: issue
npm update :: issue
npm view <private-package-name> versions :: (haven't found issue yet)
also note that npm v, npm show, and npm info are aliases that likewise don't work
Frequently, I will not know the latest version of a private module my team maintains. I would fall back on one of the commands listed above, but they seem inoperative. How can I install a package without knowing the latest version?
If I understand your question, installing latest package would be:
npm install <package_name>#latest --save
According to the documentation, running npm install package-name is supposed to install the latest version the registry knows about. This may be different for private npm instances, but there doesn't appear to be so as they reference private repos in the documentation as well.
npm install [<#scope>/]<name>#<tag>:
Install the version of the package that is referenced by the specified
tag. If the tag does not exist in the registry data for that package,
then this will fail.
Example:
npm install sax#latest
npm install #myorg/mypackage#latest
From: https://docs.npmjs.com/cli/install on Nov 23, 2016
The solution I ultimately arrived at was to use the #* syntax when running the install:
npm install --save my-off_the_hook-module#*
This seems kind of sloppy to me but it does save the latest version of the module in a manner that is, so far as I can tell, equivalent to the more familiar (and my opinion more explicit) #latest syntax.
Is it possible to install multiple versions of npm for different projects that I am working on or are the npm installations always global? (Windows 10)
Are also tried installing different versions with https://github.com/marcelklehr/nodist but it seems to affect only the node version, not the npm version.
Or does npm version actually matter? Can I just use the newest npm version even when a project says the requirement is a certain npm version?
You can install multiple versions of npm by installing multiple versions of node. To do this, you can use nvm-windows. Each different installation of node installs a different version of npm
To use a different version of node and nvm in a project, you simple need to switch:
nvm use 5.0
You can also create a .nvmrc file containing the version number in the project root directory. nvm will use the specified version of node for that project.
You also can install npm using npm
Example of installing specific version:
npm i -g npm#3.5.4
If you need to use a different version of npm for each project, there are a number of possible solutions. Probably the lightest-weight version is to use npx. A semi-common use-case for this can be projects that use lock-file v1 and another that uses lock-file v2. v2 was introduced in npm v7.
So in your project using lockfile v1, if you need to install a new package.
npx npm#v6 install dalle-node
For lockfile v2, or to just use the latest and great.
npx npm#latest install dalle-node
Or does npm version actually matter?
In most cases, it's not likely to matter much. The above example is one I run in to in my own projects. If you use a project and some of the npm commands are giving you trouble, e.g. npm run, try using the version of npm the project recommends before filing a bug with the maintainer.
if you are using eclipse IDE for Node projects, you can easily change Node version using Webclipse plugin.