報錯:npm ERR! missing script: serve npm ERR! A complete log of this run can be found in:
專案場景:
今天朋友有個報錯讓我給看一下:啟動vue專案時,報錯,啟動不了
問題描述:
npm ERR! missing script: serve
npm ERR! A complete log of this run can be found in:
這裡指的是丟失了script中的serve,run找不到,所以啟動不了
原因分析:
這裡是由於你之前建立專案時是使用的vue3.0以下的版本,啟動方式是npm run dev。但是現在更新了版本,要使用npm run serve啟動,但原來的package.json檔案中的配置,還是原來的dev,所以找不到serve
解決方案:
此時我們只需要改變一下package.json配置就好
- 刪除原來的node_modules資料夾
- 改變package.json檔案(這裡我提供一個,可能配置沒有那麼全,只要是3.0以上的配置就行)
{
"name": "hungry",//這裡可以改成你的專案名
"version": "0.1.0",
"private": true,
"scripts": {
"serve": "vue-cli-service serve",//你看,這裡就有serve啦!!!
"build": "vue-cli-service build"
},
"dependencies": {
"axios": "^0.20.0",
"vant": "^2.10.9",
"vue": "^2.6.11",
"vue-router": "^3.2.0",
"vuex": "^3.4.0"
},
"devDependencies": {
"@vue/cli-plugin-router": "~4.5.0",
"@vue/cli-plugin-vuex": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"node-sass": "^4.12.0",
"sass-loader": "^8.0.2",
"vue-template-compiler": "^2.6.11"
},
"browserslist": [
"> 1%",
"last 2 versions",
"not dead"
]
}
- cnpm i或npm i補全配置,重新生成node_modules資料夾
- npm run serve即可
相關文章
- npm A complete log of this run can be found inNPM
- npm報錯"A complete log of this run can be found in:"的解決辦法NPM
- npm install報錯, npm ERR! code MODULE_NOT_FOUNDNPM
- 使用npm install安裝webpack報錯ERRNPMWeb
- npm run dev 和 npm run serve 區別NPMdev
- npm ERR! Unexpected token in JSON at position 0 while parsing near ’ npm ERR! <!–////////NPMJSONWhile
- npm ERR! code ECONNRESET npm ERR! errno ECONNRESET網路問題解決NPM
- 【Vue】npm ERR! code ERESOLVEVueNPM
- 執行npm run dev 後報錯 Mix: not foundNPMdev
- NPM run dev 報錯NPMdev
- npm run build打包報錯 npm: should be >= 3.0.0NPMUI
- 4.WebStorm 建立vue專案,can not install ‘ij-rpc-client’/npm ERR!WebORMVueRPCclientNPM
- 釋出npm包遇到的報錯: ERR! 403 Forbidden, Are you logged in as the correct userNPMORB
- Nodejs的npm安裝模組時候報錯:npm ERR! Error: CERT_UNTRUSTED的解決方法NodeJSNPMErrorRust
- 解決:npm install ERR! Unexpected end of JSON inputNPMJSON
- npm install 出現 npm ERR! Unexpected end of JSON input while parsing near '...ostNPMJSONWhile
- npm報錯 TypeError [ERR_INVALID_ARG_TYPE]: The “path“ argument must be of type string.Received undefineNPMError
- npm install ERR Please try running this command again as root/AdministratorNPMAI
- npm包管理器報錯-npm ERR! Response timeout while trying to fetch https://registry.npmjs.org/@XXX(over 30000ms)NPMWhileHTTPJS
- npm ERR! Error: CERT_UNTRUSTED的問題解決NPMErrorRust
- yarn install,yarn add,NPM run dev 報錯YarnNPMdev
- Laravel 基礎學習 Homestead 環境 NPM err 問題LaravelNPM
- npm ERR! network request to https://registry.npmmirror.com/create-vite failed,NPMHTTPViteAI
- npm run dev 報錯:getaddrinfo ENOTFOUND localhost和解決方法NPMdevlocalhost
- npm script中&&和&NPM
- npm ERR! code CERT_HAS_EXPIRED:解決證書過期問題NPM
- npm包serve的簡單使用NPM
- npm install報錯not found: python2的結局方法NPMPython
- MySQL 5.6複製報錯Error_code: 1032; handler error HA_ERR_KEY_NOT_FOUND;MySqlError
- npm install 報錯NPM
- Windows 系統 NPM run watch-poll 報錯解決方案WindowsNPM
- Laravel 執行 NPM run watch 報錯找不到 cross-envLaravelNPMROS
- Node.js 中 TypeError [ERR_IMPORT_ASSERTION_TYPE_MISSING]Node.jsErrorImport
- 執行 NPM run watch-poll 各種報錯問題整理NPM
- Laravel 5.4 Mix執行 npm run dev時報錯,提示cross-env not found的原因及解決辦法LaravelNPMdevROS
- Laravel 執行 NPM run watch 提示 Missing binding node-Sass 解決辦法LaravelNPM
- vue init webpack-simple 和安裝elementui後 npm run dev報錯VueWebUINPMdev
- VUE: npm run dev報錯Error: error:0308010C:digital envelope routines::unsupportedVueNPMdevErrorGit