mac 安装 npm
参考:https://www.jianshu.com/p/f6c6e73ea198
前言
1、npm介绍
npm是基于nodejs的包管理器
从npm服务器下载别人编写的第三方包、模块到本地使用
从npm服务器下载安装别人编写的命令行程序到本地使用
将自己写的包、模块或者命令行程序上传到npm服务器、共别人下载
2、安装软件
1)安装node
brew install node
// TODO:
npm是随着nodejs安装一并安装的、更新npm,也可以使用npm命令行
sudo npm install npm -g
3、 npm相关命令行介绍
npm install -g xx # 全局安装,安装在/usr/local/lib
npm list -g # 查看所有全局安装的模块
npm list grunt # 查看某个模块的版本号
npm uninstall xxx # 卸载模块
npm update xxx # 更新模块
npm init # 创建模块
npm public #发布模块
package.json 文件说明
package.json 类似于cocopods中的podspec文件,是对某指定包、模块做的描述。
4 安装:html-webpack-plugin
npm install html-webpack-plugin --save-dev
参考:https://webpack.docschina.org/plugins/html-webpack-plugin/
先这样:npm install webpack@^4.0.0
参考:https://www.jianshu.com/p/30c7604a608e?utm_campaign=maleskine&utm_content=note&utm_medium=seo_notes&utm_source=recommendation
npm install --save-dev extract-text-webpack-plugin@next
参考:https://www.cnblogs.com/xuqp/p/9180961.html
copy-webpack-plugin
npm install --save-dev copy-webpack-plugin
提示:
npm ERR! Could not resolve dependency:
npm ERR! peer webpack@"^5.1.0" from copy-webpack-plugin@10.2.4
npm ERR! node_modules/copy-webpack-plugin
npm ERR! copy-webpack-plugin@"10.2.4" from the root project
npm ERR!
npm ERR! Fix the upstream dependency conflict, or retry
npm ERR! this command with --force, or --legacy-peer-deps
npm ERR! to accept an incorrect (and potentially broken) dependency resolution.
npm ERR!
npm ERR! See /Users/fuqing.yfq/.npm/eresolve-report.txt for a full report.
于是安装 5.1.0版本;
npm install copy-webpack-plugin@5.1.0
5.clean-webpack-plugin'
npm install clean-webpack-plugin
6\Cannot find module 'happypack'
npm install happypack
本文来自博客园,作者:aspirant,转载请注明原文链接:https://www.cnblogs.com/aspirant/p/15875878.html