ERROR  Failed to compile with 2 errors                                                                       3:41:32 PM  
  
 error  in ./src/components/HelloWorld.vue  
  
Module build failed: Error: No parser and no file path given, couldn't infer a parser.  
    at UndefinedParserError.Wrapper (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:1948:14)  
    at new UndefinedParserError (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:2055:83)  
    at normalize (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:7051:13)  
    at formatWithCursor (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:10370:12)  
    at C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:31115:15  
    at Object.format (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:31134:12)  
    at Object.module.exports (C:\Users\Administrator\Desktop\vue\my-project\node_modules\vue-loader\lib\template-compiler\index.js:80:23)  
  
 @ ./src/components/HelloWorld.vue 11:0-366  
 @ ./src/router/index.js  
 @ ./src/main.js  
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js  
  
 error  in ./src/App.vue  
  
Module build failed: Error: No parser and no file path given, couldn't infer a parser.  
    at _construct (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:1928:21)  
    at UndefinedParserError.Wrapper (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:1948:14)  
    at new UndefinedParserError (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:2055:83)  
    at normalize (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:7051:13)  
    at formatWithCursor (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:10370:12)  
    at C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:31115:15  
    at Object.format (C:\Users\Administrator\Desktop\vue\my-project\node_modules\prettier\index.js:31134:12)  
    at Object.module.exports (C:\Users\Administrator\Desktop\vue\my-project\node_modules\vue-loader\lib\template-compiler\index.js:80:23)  
  
 @ ./src/App.vue 11:0-354  
 @ ./src/main.js  
 @ multi (webpack)-dev-server/client?http://localhost:8080 webpack/hot/dev-server ./src/main.js  

解决方法:
运行:npm i prettier@~1.12.0
重新运行:npm run dev
解决问题!!!!
Logo

前往低代码交流专区

更多推荐