npm, nodejs, reactjs? Node and browser(javascript) both uses V8 engine, but browser has DOM, node doesn’t, nodejs has other kind of APIs, nodejs has more freedom to access the os (because it has modules like filesystem, http server, even batteries, so you can create mobile app from nodejs), both nodejs and reactjs use npm for moduel managment, but what’s the difference??

The confusing bit is that npm is a package manager for JavaScript, not necessarily node (even though node is in the name..). Therefore, we can use npm also for web applications. (If we do, we need to use a bundler like webpack though). Some npm modules might work both in the browser and in node, but some will only work on one of them. If the npm module requires some platform-spcific API (DOM for the browser for example) then it will not work for the other platform.

rm -rf ~/node_modules/

Centos install

yum install nodejs yum uninstall nodejs node -v npm -v

Upgrade to nodejs8 yum install epel-release curl –silent –location | sudo bash - yum install gcc-c++ make yum install -y nodejs

windows安装node js 在console运行,会提示找不到module,比如 cannot find module ‘request’ 只需要执行npm -request即可,如果提示 Error: ENOENT, stat ‘\AppData\Roaming\npm’ 只需要当前目录下创建npm即可 模块系统 Modules 事件 Event 函数 function 路由 route 全局对象 Global Object

Windows upgrade npm npm install -g npm-windows-upgrade npm-windows-upgrade