nodejs安装,前端代码打包

一开始安装nodejs时使用的是源码安装新版本,编译过程中报了gcc版本低的警告。


换成低版本,打包时也会报错。

> [email protected] build /home/clh/converged-media
> react-app-rewired build

Creating an optimized production build...
Failed to compile.

./src/index.tsx
Error: [BABEL] /home/clh/converged-media/src/index.tsx: Could not find plugin "proposal-numeric-separator". Ensure there is an entry in ./available-plugins.js for it. (While processing: "/home/clh/converged-media/node_modules/[email protected]@babel-preset-react-app/index.js$0")
    at Array.map ()
    at Generator.next ()
    at Generator.next ()


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] build: `react-app-rewired build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] build script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/clh/.npm/_logs/2020-03-20T17_28_39_599Z-debug.log

因此安装了编译好的版本。

wget http://nodejs.org/dist/v12.18.1/node-v12.18.1-linux-x64.tar.gz
tar -zxvf node-v12.18.1-linux-x64.tar.gz
mv node-v12.18.1 nodejs

vi ~/.bash_profie
PATH=$PATH:$HOME/.local/bin:$HOME/bin:${HOME}/nodejs/bin

source ~/.bash_profie
npm install -g cnpm --registry=https://registry.npm.taobao.org

cnpm install
npm run build

//也可用yarn
npm install -g yarn
yarn install
yarn run build
//

你可能感兴趣的:(nodejs安装,前端代码打包)