nodejs安装,前端代码打包

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


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

> mix-media-scaffold@0.1.0 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/_babel-preset-react-app@9.1.1@babel-preset-react-app/index.js$0")
    at Array.map (<anonymous>)
    at Generator.next (<anonymous>)
    at Generator.next (<anonymous>)


npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! mix-media-scaffold@0.1.0 build: `react-app-rewired build`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the mix-media-scaffold@0.1.0 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
//

最后编辑于
©著作权归作者所有,转载或内容合作请联系作者
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

推荐阅读更多精彩内容