I'm using npm to download libraries.
Is it correct to say that I'm using node.js ?
NPM is a package manager for Node.js packages, or modules.
NPM hosts thousands of free packages to download and use.
The NPM program is installed on your computer when you install Node.js
Node.js As an asynchronous event-driven JavaScript runtime, Node.js is designed to build scalable network applications.
https://nodejs.org/en/about/
Node.js is all about modularity, and with that comes the need for a quality package manager; for this purpose, npm was made. With npm comes the largest selection of community-created packages of any programming ecosystem, which makes building Node.js apps quick and easy.
https://nodejs.org/en/docs/meta/topics/dependencies/#npm
Hope I helped you see the differences.Best Regards !
Yes nodejs is a runtime environment for javascript docs here like JRE is for java. You can use Node to run javascript in you system otherwise you need a browser to run it
NPM is a library for javascript read here, you use that to install libraries incase you need to use some extra features you dont wanna code yourself
Nodejs can run w/o use of npm like you can use other library repo like yarn likewise you can use other run time environment like Deno and use npm with that w/o using node
Related
I am using rusty_v8 to create a local runtime in my cargo project and I want to integrate an npm package into the v8 runtime I am using.
since npm packages need to node runtime. and node runtime is based on v8 correct me if I am wrong. how can I make it possible to run npm packages in my v8 runtime? or if I ask another way how does google chrome's v8 use node packages without using node in its runtime.
I'm doing the courses at Laracasts and the command npm install && npm run dev is used. This didnt work from my htdocs/projectname directory so I installed the windows 10 node.js installer, which installed it to a program files directory.
Somehow, it seems node.js ended up in my packages.json
Node.js seems to be all javascript on the server side? How does this work with Laravel?
Thanks!
NodeJS can be used for many things, which include server-side code, as well as provides tools to be used in a development environment, which are available through the NPM Repository. A quote from the NodeJS Wikipedia page states the following:
Node.js is an open-source, cross-platform, back-end, JavaScript
runtime environment that executes JavaScript code outside a web
browser.
A standard Laravel installation includes a package.json file as standard, which includes the commands and requirements for various packages, one of which includes laravel-mix, which is a webpack based tool for optimizing and compiling your assets (Typically Stylesheets and Javascript).
NPM ist the Node package manager. It's installed with Node.js.
You can use npm -v in the CLI to check if it's installed correctly.
In your project directory must be a package.json to use npm install && npm run dev.
In case of Laravel a package.json should be in the directory.
I am trying to install node.js by downloading the .exe file, I am confused and stuck on the Node.js setup where in it asks to install node.js runtime or npm package manager so I want to proceed through the installation after knowing fully the difference between the two.
My question is what is the difference between node.js runtime and npm
pacakage manager and what are all the features do I get on the two
options.
My basic purpose of installing node.js is to compile Typescript, Please help me to understand the features of the two package
First of all, it does not ask you to install Node.js runtime OR npm package manager, it offers you to install them both (if you want)
Now, Node.js runtime is basically what will understand your javascript code and execute it to produce a result.
Npm package manager is a tool which will allow you to install third party libraries (other people's code) by using the command line.
npm install express
will install the framework called express for example.
Node JS
Node.js is a platform built on Chrome's JavaScript runtime for easily
building fast, scalable network applications.
Real-Time services (Chat, Games etc)
NPM
Npm is a package manager. Typically this software is installed to
build Node applications.
It let's you install software (libraries, plugins, frameworks and
applications).
Node.js or Node is an open-source, cross-platform, JavaScript runtime environment(JSRE) that executes JavaScript code outside of a web browser.
npm is a package manager(like Nuget package manager in .NET -Microsoft ) for the JavaScript programming language. It is the default package manager for the JavaScript runtime environment Node.js.
You can differentiate them by finding their version using below code.
node --version
npm --version
node is a framework that can run JavaScript code on your machine while npm is a package manager. Using npm we can install and remove javascript packages also known as node modules. Now, it is not a rule that you should use npm to install and remove node modules. We can use yarn also. npm and yarn are capable of the following:
Read and understand package.json file
Download and put javascript modules in node_modules folder.
Run scripts mentioned in package.json such as starting a node server, running in dev and production mode, running scripts for unit testing etc.
npm by default run node server.js; if you didn't specify scripts in the package.json
"scripts": {
"start": "node your-script.js"
}
Which means npm run node
if you need use yarn, you'd better choose node.js runtime, usually the default choice is a better one for beginner //TAT
I am in a unique situation where I can run npm install only on a linux based machine even though I plan to run my electron/node application on an offline Windows machine.
So, is there a way to tell npm to perform an install and "trick" it to npm install the windows version of each module?
I understand most modules are based on javascript and are not native, but a few are dependent on operating system, such as electron itself.
Perhaps I could modify any header information npm sends out which tells the servers which operating system I am running?
So, is there a way to tell npm to perform an install and "trick" it to
npm install the windows version of each module?
No. If you want NPM to install for windows, then you have to run NPM on windows.
For pure Javascript modules, you could "probably" install for Linux and then just copy the directories over to windows, but you'd have to know that these were pure Javascript modules that contained no native code and did not use any binaries or compile any native code and copying directories behind the back of NPM is asking for it to be confused about what you have.
It sounds like perhaps you should explore fixing whatever issue is keeping you from running NPM on your windows box directly.
I'm trying to use the command line tools of UglifyJs to minify my files. On the git page it says to download it using npm: npm install uglify-js -g.
Is that the only way to download it? My website doesn't use node.js so I'm wondering if there's an alternate way.
You can download it directly from it's github repo. However, I do agree with JohnnyHK it's better to install via npm as it will handle any dependancies required by UglifyJS.
When installing a module using npm -g, you're installing a command-line utility that uses node.js for its run-time rather than a module for a node.js based web site.
So it's still easiest to use npm to install it.