Open Nodewebzsz opened 6 years ago
可以试下采用 npm 替换 cnpm 进行安装
我又检查了下发现执行npm命令安装package的时候,只安装了dependencies的包,但是devDependencies的包却没有安装,只能手动到服务器里面去安装才行代码如下
--> Deploying to production environment --> on host 39.105.73.230 fatal: no upstream configured for branch 'master' ○ deploying origin/master ○ executing pre-deploy-local ○ hook pre-deploy ○ fetching updates ○ full fetch Fetching origin ○ resetting HEAD to origin/master HEAD is now at b422d5e fix ○ executing post-deploy
export NODE_ENV=production && cnpm install && npm run build && pm2 startOrRestart ecosystem.json --env production`
[1/15] lyric-parser@^1.0.1 installed at node_modules/_lyric-parser@1.0.1@lyric-parser
[2/15] fastclick@^1.0.6 installed at node_modules/_fastclick@1.0.6@fastclick
[3/15] js-base64@^2.1.9 installed at node_modules/_js-base64@2.4.8@js-base64
[4/15] vue-lazyload@^1.0.5 installed at node_modules/_vue-lazyload@1.2.6@vue-lazyload
[5/15] good-storage@^1.0.1 installed at node_modules/_good-storage@1.0.1@good-storage
[6/15] jsonp@^0.2.1 installed at node_modules/_jsonp@0.2.1@jsonp
[7/15] axios@^0.16.2 installed at node_modules/_axios@0.16.2@axios
[8/15] better-scroll@^0.4.0 installed at node_modules/_better-scroll@0.4.0@better-scroll
[9/15] vue-router@^2.3.1 installed at node_modules/_vue-router@2.8.1@vue-router
[10/15] socks@^2.2.1 installed at node_modules/_socks@2.2.1@socks
[11/15] vuex@^2.3.1 installed at node_modules/_vuex@2.5.0@vuex
[12/15] vue@^2.3.3 installed at node_modules/_vue@2.5.17@vue
[13/15] create-keyframe-animation@^0.1.0 installed at node_modules/_create-keyframe-animation@0.1.0@create-keyframe-animation
[14/15] babel-runtime@^6.23.0 installed at node_modules/_babel-runtime@6.26.0@babel-runtime
[15/15] babel-polyfill@^6.23.0 installed at node_modules/_babel-polyfill@6.26.0@babel-polyfill
Recently updated (since 2018-07-29): 2 packages (detail see file /home/zsz_user/www/website/production/source/node_modules/.recently_updates.txt)
2018-08-02
→ axios@0.16.2 › follow-redirects@^1.2.3(1.5.2) (02:34:57)
→ vue@^2.3.3(2.5.17) (03:31:34)
All packages installed (42 packages installed from npm registry, used 2s(network 2s), speed 1.63MB/s, json 40(483.35kB), tarball 2.18MB)
vue-music@1.0.0 build /home/zsz_user/www/website/production/source node build/build.js
module.js:471 throw err; ^
Error: Cannot find module 'chalk'
at Function.Module._resolveFilename (module.js:469:15)
at Function.Module._load (module.js:417:25)
at Module.require (module.js:497:17)
at require (internal/module.js:20:19)
at Object.node build/build.js
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the vue-music@1.0.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/zsz_user/.npm/_logs/2018-08-04T16_37_18_210Z-debug.log
post-deploy hook failed
Deploy failed`
使用这个命令在服务器上再次确认一下是否只安装了 dependencies 中的依赖:npm list --depth=0 2>/dev/null
或 yarn list --depth=0 2>/dev/null
,这个问题我也偶尔遇到过,有时候也会在服务器上重新安装,要不你就换 yarn
试一下去安装依赖
本地package.json文件都有这些模块,但是拉去代码到服务器之后执行deploy就报这个错误,到服务器端到production文件夹去看时没问题的
--> Deploying to production environment --> on host 39.105.73.230 fatal: no upstream configured for branch 'master' ○ deploying origin/master ○ executing pre-deploy-local ○ hook pre-deploy ○ fetching updates ○ full fetch Fetching origin ○ resetting HEAD to origin/master HEAD is now at c22d75d fix ○ executing post-deploy
export NODE_ENV=production && cnpm install && node build/build.js && pm2 startOrRestartecosystem.json --env production` [1/15] fastclick@^1.0.6 installed at node_modules/_fastclick@1.0.6@fastclick [2/15] lyric-parser@^1.0.1 installed at node_modules/_lyric-parser@1.0.1@lyric-parser [3/15] js-base64@^2.1.9 installed at node_modules/_js-base64@2.4.8@js-base64 [4/15] jsonp@^0.2.1 installed at node_modules/_jsonp@0.2.1@jsonp [5/15] good-storage@^1.0.1 installed at node_modules/_good-storage@1.0.1@good-storage [6/15] vue-lazyload@^1.0.5 installed at node_modules/_vue-lazyload@1.2.6@vue-lazyload [7/15] axios@^0.16.2 installed at node_modules/_axios@0.16.2@axios [8/15] better-scroll@^0.4.0 installed at node_modules/_better-scroll@0.4.0@better-scroll [9/15] vue-router@^2.3.1 installed at node_modules/_vue-router@2.8.1@vue-router [10/15] socks@^2.2.1 installed at node_modules/_socks@2.2.1@socks [11/15] vuex@^2.3.1 installed at node_modules/_vuex@2.5.0@vuex [12/15] vue@^2.3.3 installed at node_modules/_vue@2.5.17@vue [13/15] create-keyframe-animation@^0.1.0 installed at node_modules/_create-keyframe-animation@0.1.0@create-keyframe-animation [14/15] babel-runtime@^6.23.0 installed at node_modules/_babel-runtime@6.26.0@babel-runtime [15/15] babel-polyfill@^6.23.0 installed at node_modules/_babel-polyfill@6.26.0@babel-polyfill Recently updated (since 2018-07-28): 2 packages (detail see file /home/zsz_user/www/website/production/source/node_modules/.recently_updates.txt) 2018-08-02 → axios@0.16.2 › follow-redirects@^1.2.3(1.5.2) (02:34:57) → vue@^2.3.3(2.5.17) (03:31:34) All packages installed (42 packages installed from npm registry, used 2s(network 2s), speed 1.58MB/s, json 40(387.09kB), tarball 2.18MB) module.js:471 throw err; ^Error: Cannot find module 'chalk' at Function.Module._resolveFilename (module.js:469:15) at Function.Module._load (module.js:417:25) at Module.require (module.js:497:17) at require (internal/module.js:20:19) at Object. (/home/zsz_user/www/website/production/source/build/check-versions.js:1:75)
at Module._compile (module.js:570:32)
at Object.Module._extensions..js (module.js:579:10)
at Module.load (module.js:487:32)
at tryModuleLoad (module.js:446:12)
at Function.Module._load (module.js:438:3)
post-deploy hook failed
Deploy failed`