To install it, you can run: npm install --save element-theme-chalk/element-diy-ui/index.css 前端构建失败问题

Posted 阶梯之上

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了To install it, you can run: npm install --save element-theme-chalk/element-diy-ui/index.css 前端构建失败问题相关的知识,希望对你有一定的参考价值。

本人在使用linux构建前端时(使用npm run build命令),出现如下错误,但第二次构建时构建成功。

136.This dependency was not found:
137.
138.* element-theme-chalk/element-diy-ui/index.css in ./src/components/elementUi/index.js
139.
140.To install it, you can run: npm install --save element-theme-chalk/element-diy-ui/index.css

网上资料也查了,经过排查,是由于package.json配置出现问题

原来的配置如下


  "name": "test",
  "version": "1.0.0",
  "description": "test",
  "private": true,
  "scripts": 
    ...
    "build": "npm run theme:build & vue-cli-service build",
    "theme:build": "node build/theme.js build"
    ...
  ,
  "dependencies": 
    ...
  ,
  "devDependencies": 
    ...
  

发现执行npm run build时,是同时执行了npm run theme:build和vue-cli-service build命令,问题就出在&上,经资料查询linux的bash命令中&代表并行,&&代表串行,而我们的目的是希望先执行前面的npm run theme:build命令,成功后再执行vue-cli-service build命令,所以这里应该把&修改为&&,修改后配置如下


  "name": "test",
  "version": "1.0.0",
  "description": "test",
  "private": true,
  "scripts": 
    ...
    "build": "npm run theme:build && vue-cli-service build",
    "theme:build": "node build/theme.js build"
    ...
  ,
  "dependencies": 
    ...
  ,
  "devDependencies": 
    ...
  

 

以上是关于To install it, you can run: npm install --save element-theme-chalk/element-diy-ui/index.css 前端构建失败问题的主要内容,如果未能解决你的问题,请参考以下文章

To install it, you can run: npm install --save element-theme-chalk/element-diy-ui/index.css 前端构建失败问题

To install it, you can run: npm install --save element-theme-chalk/element-diy-ui/index.css 前端构建失败问题

Error:To install them, you can run: npm install --save vue-style-loader css-loader……

Error:To install them, you can run: npm install --save vue-style-loader css-loader……

Failed to resolve loader: script-loader You may need to install it.

Failed to resolve loader: script-loader You may need to install it.