[NPM] Solve the problem that cnpm cannot be packaged

The test environment has a front-end project that needs to be scanned by SonarQube and has been packaged well, but today it suddenly cannot be packaged using cnpm run build. Go to the server to see what kind of error is reported.

Since there is a problem with the originally packaged environment, first kill node_modules and package-lock.json and then try again with cnpm install, and get the following results.

[root@node6 yunlu-portals-sonar]# cnpm install[13/26] Installing @babel/core@^7.11.0platform unsupported @vue/[email protected][email protected][email protected][email protected] › fsevents@~2.3.2 Package require os(darwin) not compatible with your platform(linux)
[fsevents@~2.3.2] optional install error: Package require os(darwin) not compatible with your platform(linux)[15/26] Installing js-yaml@^3.13.1platform unsupported @vue/[email protected][email protected][email protected][email protected][email protected] › fsevents@^1.2.7 Package require os(darwin) not compatible with your platform(linux)
[fsevents@^1.2.7] optional install error: Package require os(darwin) not compatible with your platform(linux)[15/26] Installing javascript-stringify@^2.0.1[vue-loader-v16@npm:vue-loader@^16.1.0] optional install error: Error: Unsupported URL Type: npm:vue-loader@^16.1.0
at parseUrl (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/npm-package-arg/npa.js:186:13)
at npa (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/npm-package-arg/npa.js:79:12)
at _install (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/lib/install.js:62:11)
at _install.next (<anonymous>)
at onFulfilled (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/co/index.js:65:19)
at /usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/co/index.js:54:5
at new Promise (<anonymous>)
at co (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/co/index.js:50:10)
at toPromise (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/co/index.js:118:63)
at next (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/co/index.js:99:29)

......

[5/11] scripts.postinstall [email protected][email protected] › pngquant-bin@^6.0.0 run "node lib/install.js", root: "/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/[email protected]@pngquant-bin"
pngquant pre-build test passed successfully
[5/11] scripts.postinstall [email protected][email protected] › pngquant-bin@^6.0.0 finished in 651ms
[6/11] scripts.postinstall [email protected][email protected] › mozjpeg@^7.0.0 run "node lib/install.js", root: "/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/[email protected]@mozjpeg"
Command failed: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/[email protected]@mozjpeg/vendor/cjpeg -version
/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/[email protected]@mozjpeg/vendor/cjpeg: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/[email protected]@mozjpeg/vendor/cjpeg)


mozjpeg pre-build test failed
compiling from source
Error: Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found


at Promise.all.then.arr (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/[email protected]@execa/index.js:231:11)
at process._tickCallback (internal/process/next_tick.js:68:7)
[npminstall:runscript:error] [email protected][email protected] › mozjpeg@^7.0.0 scripts.postinstall run "node lib/install.js" error: RunScriptError: Run "sh -c node lib/install.js" error, exit code 1
✖ Install fail! RunScriptError: post install error, please remove node_modules before retry!
Run "sh -c node lib/install.js" error, exit code 1
RunScriptError: post install error, please remove node_modules before retry!
Run "sh -c node lib/install.js" error, exit code 1
at ChildProcess.proc.on.code (/usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/runscript/index.js:96:21)
at ChildProcess.emit (events.js:189:13)
at Process.ChildProcess._handle.onexit (internal/child_process.js:248:12)
npminstall version: 3.28.1
npminstall args: /usr/local/node-v10.15.3-linux-x64/bin/node /usr/local/node-v10.15.3-linux-x64/lib/node_modules/cnpm/node_modules/npminstall/bin/install.js --fix-bug-versions --china --userconfig=/root/.cnpmrc --disturl=https://npm.taobao.org/mirrors/node --registry=https://r.npm.taobao.org

......

According to the output error report, we can’t find much useful information. Since the first part of the error report shows the most prompts

[fsevents@~2.3.2] optional install error: Package require os(darwin) not compatible with your platform(linux)

Then let's try it directly with npm install without cnpm (of course, we need to kill node_modules and package-lock.json first).

[root@node6 yunlu-portals-sonar]# npm install

......

> [email protected] install /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass
> node scripts/install.js

Unable to save binary /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/vendor/linux-x64-64 : {
    
     Error: EACCES: permission denied, mkdir '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/vendor'
    at Object.mkdirSync (fs.js:752:3)
    at sync (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/mkdirp/index.js:74:13)
    at Function.sync (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/mkdirp/index.js:80:24)
    at checkAndDownloadBinary (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/scripts/install.js:114:11)
    at Object.<anonymous> (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/scripts/install.js:157:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
    at Module.load (internal/modules/cjs/loader.js:600:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:539:12)
    at Function.Module._load (internal/modules/cjs/loader.js:531:3)
  errno: -13,
  syscall: 'mkdir',
  code: 'EACCES',
  path:
   '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/vendor' }

> [email protected] install /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie
> node bin/install.js

setting up Git hooks
{
    
     Error: EACCES: permission denied, open '/root/.jenkins/workspace/yunlu-portals-sonar/.git/hooks/applypatch-msg'
    at Object.openSync (fs.js:438:3)
    at Object.writeFileSync (fs.js:1189:35)
    at write (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie/src/install.js:18:6)
    at createHook (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie/src/install.js:60:5)
    at /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie/src/install.js:86:21
    at Array.map (<anonymous>)
    at installFrom (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie/src/install.js:83:10)
    at Object.<anonymous> (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie/bin/install.js:24:1)
    at Module._compile (internal/modules/cjs/loader.js:701:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:712:10)
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path:
   '/root/.jenkins/workspace/yunlu-portals-sonar/.git/hooks/applypatch-msg' }

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

......

gyp ERR! configure error 
gyp ERR! stack Error: EACCES: permission denied, mkdir '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/.node-gyp'
gyp ERR! System Linux 3.10.0-1160.59.1.el7.x86_64
gyp ERR! command "/usr/local/node-v10.15.3-linux-x64/bin/node" "/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-gyp/bin/node-gyp.js" "rebuild" "--verbose" "--libsass_ext=" "--libsass_cflags=" "--libsass_ldflags=" "--libsass_library="
gyp ERR! cwd /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass
gyp ERR! node -v v10.15.3
gyp ERR! node-gyp -v v3.8.0
gyp ERR! not ok 
Build failed with error code: 1

......

npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! [email protected] postinstall: `node scripts/build.js`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the [email protected] postinstall 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!     /root/.npm/_logs/2022-10-25T06_32_21_501Z-debug.log

......

Although there is no "Package require os(darwin) not compatible with your platform(linux)" problem when using npm, there is a new problem and most of them are caused by [email protected]. The breakthrough lies in the sentence "stack Error: EACCES: permission denied, mkdir '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/.node-gyp'", which I have already used The root account is used to perform npm operations, why do I still say "permission denied"?

Later, I checked many articles on the Internet and found that npm has a life cycle, and it will be automatically downgraded for security reasons, so it needs to be unlocked through the –unsafe-perm parameter. Npm will read the configuration information in order before execution: cli -> env -> npmrc -> default (according to the current company's practice, there should be no configuration, so it is inferred that the default configuration will be read in the end), for the unix platform, When using the root user to execute the npm command, the default value obtained by –unsafe-perm will be false, which should be manually set to true or added during npm install.

[root@node6 yunlu-portals-sonar]# npm install --unsafe-perm
npm WARN deprecated [email protected]: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated [email protected]: babel-eslint is now @babel/eslint-parser. This package will no longer receive updates.

......

> [email protected] install /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-64_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.14.1/linux-x64-64_binding.node": 

ETIMEDOUT

Timed out attemping to establish a remote connection

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g. 

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> [email protected] install /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/yorkie
> node bin/install.js

setting up Git hooks
done


> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js:
> https://opencollective.com/core-js 
> https://patreon.com/zloirock 
> bitcoin: bc1qlea7544qtsmj2rayg0lthvza9fau63ux0fstcz 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)


> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass
> node scripts/build.js

Building: /usr/local/node-v10.15.3-linux-x64/bin/node /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-gyp/bin/node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [ '/usr/local/node-v10.15.3-linux-x64/bin/node',
gyp verb cli   '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-gyp/bin/node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library=' ]
gyp info using [email protected]
gyp info using [email protected] | linux | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` succeeded python2 /usr/bin/python2
gyp verb check python version `/usr/bin/python2 -c "import sys; print "2.7.5
gyp verb check python version .%s.%s" % sys.version_info[:3];"` returned: %j
gyp verb get node dir no --target version specified, falling back to host node version: 10.15.3
gyp verb command install [ '10.15.3' ]
gyp verb install input version string "10.15.3"
gyp verb install installing version: 10.15.3
gyp verb install --ensure was passed, so won't reinstall if already installed
gyp verb install version not already installed, continuing with install 10.15.3
gyp verb ensuring nodedir is created /root/.node-gyp/10.15.3
gyp verb created nodedir /root/.node-gyp
gyp http GET https://nodejs.org/download/release/v10.15.3/node-v10.15.3-headers.tar.gz
gyp http 200 https://nodejs.org/download/release/v10.15.3/node-v10.15.3-headers.tar.gz
gyp verb extracted file from tarball include/node/common.gypi
gyp verb extracted file from tarball include/node/config.gypi
gyp verb extracted file from tarball include/node/node.h

......

gyp verb tarball done parsing tarball
gyp verb check download content checksum, need to download `SHASUMS256.txt`... 
gyp verb checksum url https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp http GET https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp http 200 https://nodejs.org/download/release/v10.15.3/SHASUMS256.txt
gyp verb checksum data {"node-v10.15.3-aix-ppc64.tar.gz":"f2f018418b6bfa263ec981f04f3fa5337724edae8d77fc3951cd36667ee720ea","node-v10.15.3-darwin-x64.tar.gz":"7a5eaa1f69614375a695ccb62017248e5dcc15b0b8edffa7db5b52997cf992ba","node-v10.15.3-darwin-x64.tar.xz":"8e3df823a58c7b2de327540a0b57a9bcf3f706108fe65c4cde9a073caae68cee","node-v10.15.3-headers.tar.gz":"9e97ee69072836bfbf2a85c4af627ed152574c30c5a32e40fbfcdfda8d9b562e","node-v10.15.3-headers.tar.xz":"f690b8808ccfeb5959436073717b648e4bdc521e3217ab7092d5c033326f6133","node-v10.15.3-linux-arm64.tar.gz":"c82cd99e01f6e26830f0b3e0465f12f92957ebd69a68c91c03228c2669104359","node-v10.15.3-linux-arm64.tar.xz":"3d7abbf64bffb07c55168ca0f1c17be12b0d93affe9b6cadd39724649215fab9","node-v10.15.3-linux-armv6l.tar.gz":"72529b6f77d95f9422f6d1c6b88c1f921b00e5500a1c3ea05927f1ae3704133d","node-v10.15.3-linux-armv6l.tar.xz":"94432c2944fc78c2d5e82103f73596a060451330839562c04c414067007c5997","node-v10.15.3-linux-armv7l.tar.gz":"6958551264884cd479f15ed8d40673655a283ed3bd8552d04e8531cd3ccdf483","node-v10.15.3-linux-armv7l.tar.xz":"af2106b08f68e0884caa505ea7e695facc5b4cd356f1e08258899e94cc4c5df0","node-v10.15.3-linux-ppc64le.tar.gz":"0544b08467384ba3b3a462d8907d12cea71ac371f3d118057905dd845be43aad","node-v10.15.3-linux-ppc64le.tar.xz":"a2fcc2e1827d7a034f39aad8225b4dd72376ad19f7a7884645a512aeeedf4ab5","node-v10.15.3-linux-s390x.tar.gz":"073e6e2ad4e3a7580d87e5b70b9c1ce785b15e849dfd4f2f846c3039ad1e116c","node-v10.15.3-linux-s390x.tar.xz":"545caa31bf06b150861ca3a2b1f5112aa92bb855de20fd98f8b7bc3f4c4311d7","node-v10.15.3-linux-x64.tar.gz":"6c35b85a7cd4188ab7578354277b2b2ca43eacc864a2a16b3669753ec2369d52","node-v10.15.3-linux-x64.tar.xz":"faddbe418064baf2226c2fcbd038c3ef4ae6f936eb952a1138c7ff8cfe862438","node-v10.15.3.pkg":"f4d0b944618afae2835b500e0cc1c5a013912597fce5560cd4bcb534f5270754","node-v10.15.3-sunos-x64.tar.gz":"c678b8e5a2d652f920c1093e6249b08e4746c2d37a5b9f719d04f3243776fb01","node-v10.15.3-sunos-x64.tar.xz":"3732ae66ad564c192ff3a4a6e66e0d8922823c128bb8a6766ece87226982ad54","node-v10.15.3.tar.gz":"db460a63d057ac015b75bb6a879fcbe2fefaaf22afa4b6f6445b9db61ce2270d","node-v10.15.3.tar.xz":"4e22d926f054150002055474e452ed6cbb85860aa7dc5422213a2002ed9791d5","node-v10.15.3-win-x64.7z":"9df98cac063229aca443c040fd342a96667891bb8eda821d10aa4d49347d7add","node-v10.15.3-win-x64.zip":"93c881fdc0455a932dd5b506a7a03df27d9fe36155c1d3f351ebfa4e20bf1c0d","node-v10.15.3-win-x86.7z":"597a372964252daaba4cb8dcac57305f79cffeeca579625f0cd6ab85d29ccdda","node-v10.15.3-win-x86.zip":"fc28bbd08b3d9b621c7c0ecd2b42506ca2f356f31f2b64210f413b34cff31799","node-v10.15.3-x64.msi":"46b3d03c96de0b9e7d3a204c67772759283221f5e58ac225df813076a65e2738","node-v10.15.3-x86.msi":"e73398cde3e054da7a0a05a86aa512a47a24b961b0659be30a0f01606ca234a9","win-x64/node.exe":"a921d1a4fa463e877087b3f25abd0ab05b63489bffcc9ff47acbbeee4e1b7494","win-x64/node.lib":"4ed045ae1ba046506948b8f90c02716178cb0084f3b56866ac8d23b591e83235","win-x64/node_pdb.7z":"538c8cc4e0b93facb9d63ed6c55d765ec33a18dd264c6c8b9415ad242521d8e6","win-x64/node_pdb.zip":"525ea4adfd5c166076b273db6c0803283c57c4116fce56229ce87c8eb9fcdd25","win-x86/node.exe":"39efb2a884d2f73680b986534eed000017ce16993ea9d695351593ffb9a7bb34","win-x86/node.lib":"efed715422fcb7032290ec3c7e3b324126e082ee3a87d6ac497f6c97549e478e","win-x86/node_pdb.7z":"38775185b6f6c090e7039ea0b3e630f4ab83e5c259d8d94f0f35f04ec12c0e98","win-x86/node_pdb.zip":"1848e05e130dda3c3b53830cb78c4b28c137c7aac0890b70a8c863798c332ed5"}
gyp verb download contents checksum {"node-v10.15.3-headers.tar.gz":"9e97ee69072836bfbf2a85c4af627ed152574c30c5a32e40fbfcdfda8d9b562e"}
gyp verb validating download checksum for node-v10.15.3-headers.tar.gz (9e97ee69072836bfbf2a85c4af627ed152574c30c5a32e40fbfcdfda8d9b562e == 9e97ee69072836bfbf2a85c4af627ed152574c30c5a32e40fbfcdfda8d9b562e)
gyp verb get node dir target node version installed: 10.15.3
gyp verb build dir attempting to create "build" dir: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/build
gyp verb build dir "build" dir needed to be created? /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/build
gyp verb build/config.gypi creating config file
gyp verb build/config.gypi writing out config file: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/build/config.gypi
gyp verb config.gypi checking for gypi file: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/config.gypi
gyp verb common.gypi checking for gypi file: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/common.gypi
gyp verb gyp gyp format was not specified; forcing "make"
gyp info spawn /usr/bin/python2
gyp info spawn args [ '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-gyp/gyp/gyp_main.py',
gyp info spawn args   'binding.gyp',
gyp info spawn args   '-f',
gyp info spawn args   'make',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.node-gyp/10.15.3/include/node/common.gypi',
gyp info spawn args   '-Dlibrary=shared_library',
gyp info spawn args   '-Dvisibility=default',
gyp info spawn args   '-Dnode_root_dir=/root/.node-gyp/10.15.3',
gyp info spawn args   '-Dnode_gyp_dir=/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.node-gyp/10.15.3/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass',
gyp info spawn args   '-Dnode_engine=v8',
gyp info spawn args   '--depth=.',
gyp info spawn args   '--no-parallel',
gyp info spawn args   '--generator-output',
gyp info spawn args   'build',
gyp info spawn args   '-Goutput_dir=.' ]
gyp verb command build []
gyp verb build type Release
gyp verb architecture x64
gyp verb node dev dir /root/.node-gyp/10.15.3
gyp verb `which` succeeded for `make` /usr/bin/make
gyp info spawn make
gyp info spawn args [ 'V=1', 'BUILDTYPE=Release', '-C', 'build' ]
make: Entering directory `/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/build'
  g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.5.5"' -I/root/.node-gyp/10.15.3/include/node -I/root/.node-gyp/10.15.3/src -I/root/.node-gyp/10.15.3/deps/openssl/config -I/root/.node-gyp/10.15.3/deps/openssl/openssl/include -I/root/.node-gyp/10.15.3/deps/uv/include -I/root/.node-gyp/10.15.3/deps/zlib -I/root/.node-gyp/10.15.3/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++1y -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast.o ../src/libsass/src/ast.cpp
  g++ '-DNODE_GYP_MODULE_NAME=libsass' '-DUSING_UV_SHARED=1' '-DUSING_V8_SHARED=1' '-DV8_DEPRECATION_WARNINGS=1' '-D_LARGEFILE_SOURCE' '-D_FILE_OFFSET_BITS=64' '-DLIBSASS_VERSION="3.5.5"' -I/root/.node-gyp/10.15.3/include/node -I/root/.node-gyp/10.15.3/src -I/root/.node-gyp/10.15.3/deps/openssl/config -I/root/.node-gyp/10.15.3/deps/openssl/openssl/include -I/root/.node-gyp/10.15.3/deps/uv/include -I/root/.node-gyp/10.15.3/deps/zlib -I/root/.node-gyp/10.15.3/deps/v8/include -I../src/libsass/include  -fPIC -pthread -Wall -Wextra -Wno-unused-parameter -m64 -O3 -fno-omit-frame-pointer -std=gnu++1y -std=c++0x -fexceptions -frtti -MMD -MF ./Release/.deps/Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o.d.raw   -c -o Release/obj.target/libsass/src/libsass/src/ast_fwd_decl.o ../src/libsass/src/ast_fwd_decl.cpp

  ......

  g++ -shared -pthread -rdynamic -m64  -Wl,-soname=binding.node -o Release/obj.target/binding.node -Wl,--start-group Release/obj.target/binding/src/binding.o Release/obj.target/binding/src/create_string.o Release/obj.target/binding/src/custom_function_bridge.o Release/obj.target/binding/src/custom_importer_bridge.o Release/obj.target/binding/src/sass_context_wrapper.o Release/obj.target/binding/src/sass_types/boolean.o Release/obj.target/binding/src/sass_types/color.o Release/obj.target/binding/src/sass_types/error.o Release/obj.target/binding/src/sass_types/factory.o Release/obj.target/binding/src/sass_types/list.o Release/obj.target/binding/src/sass_types/map.o Release/obj.target/binding/src/sass_types/null.o Release/obj.target/binding/src/sass_types/number.o Release/obj.target/binding/src/sass_types/string.o Release/obj.target/src/sass.a -Wl,--end-group 
  rm -rf "Release/binding.node" && cp -af "Release/obj.target/binding.node" "Release/binding.node"
make: Leaving directory `/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/build'
gyp info ok 
Installed to /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/node-sass/vendor/linux-x64-64/binding.node

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/cwebp-bin
> node lib/install.js

  ⚠ Command failed: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/cwebp-bin/vendor/cwebp -version
/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/cwebp-bin/vendor/cwebp: error while loading shared libraries: libGL.so.1: cannot open shared object file: No such file or directory


  ⚠ cwebp pre-build test failed
  ℹ compiling from source
  ✔ cwebp built successfully

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/gifsicle
> node lib/install.js

gifsicle pre-build test passed successfully

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/mozjpeg
> node lib/install.js

Command failed: /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/mozjpeg/vendor/cjpeg -version
/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/mozjpeg/vendor/cjpeg: /lib64/libz.so.1: version `ZLIB_1.2.9' not found (required by /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/mozjpeg/vendor/cjpeg)


mozjpeg pre-build test failed
compiling from source
Error: Command failed: /bin/sh -c autoreconf -fiv
/bin/sh: autoreconf: command not found


    at Promise.all.then.arr (/root/.jenkins/workspace/yunlu-portals-sonar/node_modules/bin-build/node_modules/execa/index.js:231:11)
    at process._tickCallback (internal/process/next_tick.js:68:7)

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/optipng-bin
> node lib/install.js

(node:50697) MaxListenersExceededWarning: Possible EventEmitter memory leak detected. 11 SIGINT listeners added. Use emitter.setMaxListeners() to increase limit
optipng pre-build test passed successfully

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/pngquant-bin
> node lib/install.js

pngquant pre-build test passed successfully

> [email protected] postinstall /root/.jenkins/workspace/yunlu-portals-sonar/node_modules/swiper
> node -e "try{require('./postinstall')}catch(e){}"

Love Swiper? Support Vladimir's work by donating or pledging: 
> On Patreon https://patreon.com/vladimirkharlampidi 
> On Open Collective https://opencollective.com/swiper
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.3.2 (node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {
    
    "os":"darwin","arch":"any"} (current: {
    
    "os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/watchpack-chokidar2/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {
    
    "os":"darwin","arch":"any"} (current: {
    
    "os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: vue-loader-v16@npm:vue-loader@^16.1.0 (node_modules/@vue/cli-service/node_modules/vue-loader-v16):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Invalid dependency type requested: alias
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for [email protected]: wanted {
    
    "os":"darwin","arch":"any"} (current: {
    
    "os":"linux","arch":"x64"})
npm WARN [email protected] requires a peer of swiper@^5.2.0 but none is installed. You must install peer dependencies yourself.
npm WARN @vue/[email protected] requires a peer of @vue/compiler-sfc@^3.0.0-beta.14 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] (node_modules/mozjpeg):
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: [email protected] postinstall: `node lib/install.js`
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: Exit status 1

added 1807 packages from 747 contributors in 218.88s

After npm install is successful, the project can be compiled

[root@node6 yunlu-portals-sonar]# npm run build--test

> [email protected] build--test /root/.jenkins/workspace/yunlu-portals-sonar
> vue-cli-service build --mode test


 WARN  A new version of sass-loader is available. Please upgrade for best experience.
⠹  Building for test...

 WARNING  Compiled with 27 warnings                                                                                                                                         2:44:00 PM

Module Warning (from ./node_modules/eslint-loader/index.js):

/root/.jenkins/workspace/yunlu-portals-sonar/src/App.vue
  54:11  warning  Unexpected console statement  no-console

✖ 1 problem (0 errors, 1 warning)


......

Module Warning (from ./node_modules/thread-loader/dist/cjs.js):

/root/.jenkins/workspace/yunlu-portals-sonar/src/utils/request.js
   30:5  warning  Unexpected console statement  no-console
  181:7  warning  Unexpected console statement  no-console

✖ 2 problems (0 errors, 2 warnings)


 @ ./src/main.js 19:0-38 22:22-29 23:26-33 24:24-31 25:21-28 26:21-28 27:24-31
 @ multi ./src/main.js

 warning  

asset size limit: The following asset(s) exceed the recommended size limit (244 KiB).
This can impact web performance.
Assets: 
  assets/img/collageBack.21c63be2.png (382 KiB)
  assets/img/1.81e7b71c.jpeg (572 KiB)
  assets/img/5.0d5efaf0.png (539 KiB)
  assets/img/3.4b8911f9.jpeg (936 KiB)
  assets/js/chunk-vendors.8cb38fe5.js (925 KiB)
  assets/js/chunk-vendors.8cb38fe5.js.gz (251 KiB)

 warning  

entrypoint size limit: The following entrypoint(s) combined asset size exceeds the recommended limit (244 KiB). This can impact web performance.
Entrypoints:
  app (1.26 MiB)
      assets/css/chunk-vendors.b7a1ac8e.css
      assets/js/chunk-vendors.8cb38fe5.js
      assets/css/app.90f70f38.css
      assets/js/app.a3a124b8.js


  File                                           Size                                                             Gzipped

  dist/assets/js/chunk-vendors.8cb38fe5.js       925.10 KiB                                                       251.98 KiB

  ......

  dist/assets/css/chunk-5c262660.9214b722.css    0.06 KiB                                                         0.08 KiB

  Images and other types of assets omitted.

 DONE  Build complete. The dist directory is ready to be deployed.
 INFO  Check out deployment instructions at https://cli.vuejs.org/guide/deployment.html

Guess you like

Origin blog.csdn.net/kida_yuan/article/details/127525888