搭建

285 阅读1分钟

npm换源

npm config set registry https://registry.npm.taobao.org
-- 配置后可通过下面方式来验证是否成功
npm config get registry
-- 或npm info express

移出node_modules

npm install -g rimraf --安装(推荐全局安装)
rimraf node_modules   --使用

npm命令无权限

方式一: 重新安装个node version manager。
参考:https://docs.npmjs.com/getting-started/installing-node
方式二: 改变npm默认的路径。
执行以下命令
(1)创建全局安装目录
mkdir ~/.npm-global
(2)npm使用新目录
npm config set prefix '~/.npm-global'
(3)在~/.profile文件中增加配置
export PATH=~/.npm-global/bin:$PATH
(4)配置生效
source ~/.profile

webpack

command not found 环境变量

vi ~/.bash_profile
export NODE_HOME=/Users/<yourname>/.npm-global  
export PATH=$PATH:$NODE_HOME/bin
source .bash_profile
echo $PATH

打包: Chunk.entrypoints: Use Chunks.groupsIterable and filter by instanceof Entrypoint instead

npm i –D extract-text-webpack-plugin@next // @4.0.0-beta.0版本