vuejs / vue-cli

🛠️ webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.76k stars 6.33k forks source link

`vue create` fails when using custom setup with Unit testing and Jest #6445

Open Zikoat opened 3 years ago

Zikoat commented 3 years ago

Version

4.5.12

Environment info

Environment Info:

  System:
    OS: Windows 10 10.0.19042
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 15.14.0 - C:\Program Files\nodejs\node.EXE
    Yarn: Not Found
    npm: 7.9.0 - C:\Program Files\nodejs\npm.CMD
  Browsers:
    Chrome: 90.0.4430.85
    Edge: Spartan (44.19041.906.0), Chromium (90.0.818.46)
  npmGlobalPackages:
    @vue/cli: Not Found

Steps to reproduce

1.

vue create test
  1. (optional) Overwrite
  2. Select Manually select features
  3. Features: Enable Unit testing
  4. vue version: (default) 2.x
  5. Linter/formatter: (default) Eslint with error prevention only
  6. Lint features: (default)
  7. Unit testing framework: Jest
  8. Config placement: (default) In dedicated config files
  9. Save preset: (default) N

Workaround: Use mocha chai as unit testing framework.

What is expected?

Vue creates a project without errors, or shows an error message that these settings are unavailable.

What is actually happening?

Fails with error message (ignore the Warning: Ignoring extra certs warnings)

Warning: Ignoring extra certs from `C:\Users\sscho\AppData\Local\mkcert`, load failed: error:02001005:system library:fopen:Input/output error
Warning: Ignoring extra certs from `C:\Users\sscho\AppData\Local\mkcert`, load failed: error:02001005:system library:fopen:Input/output error
npm ERR! code 1
npm ERR! path C:\test\node_modules\deasync
npm ERR! command failed
npm ERR! command C:\WINDOWS\system32\cmd.exe /d /s /c node ./build.js
npm ERR! `win32-x64-node-15` exists; testing
npm ERR! Problem with the binary; manual build incoming
npm ERR! stdout=
npm ERR! err=null
npm ERR! Warning: Ignoring extra certs from `C:\Users\sscho\AppData\Local\mkcert`, load failed: error:02001005:system library:fopen:Input/output error
npm ERR! Warning: Ignoring extra certs from `C:\Users\sscho\AppData\Local\mkcert`, load failed: error:02001005:system library:fopen:Input/output error
npm ERR! Warning: Ignoring extra certs from `C:\Users\sscho\AppData\Local\mkcert`, load failed: error:02001005:system library:fopen:Input/output error
npm ERR! gyp: Call to 'node -p "require('node-addon-api').include"' returned exit status 0 while in binding.gyp. while trying to load binding.gyp
npm ERR! gyp ERR! configure error
npm ERR! gyp ERR! stack Error: `gyp` failed with exit code: 1
npm ERR! gyp ERR! stack     at ChildProcess.onCpExit (C:\Users\sscho\AppData\Roaming\npm\node_modules\npm\node_modules\node-gyp\lib\configure.js:351:16)
npm ERR! gyp ERR! stack     at ChildProcess.emit (node:events:369:20)
npm ERR! gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
npm ERR! gyp ERR! System Windows_NT 10.0.19042
npm ERR! gyp ERR! command "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\sscho\\AppData\\Roaming\\npm\\node_modules\\npm\\node_modules\\node-gyp\\bin\\node-gyp.js" "rebuild"
npm ERR! gyp ERR! cwd C:\test\node_modules\deasync
npm ERR! gyp ERR! node -v v15.14.0
npm ERR! gyp ERR! node-gyp -v v7.1.2
npm ERR! gyp ERR! not ok
npm ERR! Build failed

npm ERR! A complete log of this run can be found in:
npm ERR!     C:\Users\sscho\AppData\Local\npm-cache\_logs\2021-04-27T06_49_55_509Z-debug.log
 ERROR  command failed: npm install --loglevel error --legacy-peer-deps

LanFeusT23 commented 3 years ago

Exactly the same error here on installing that deasync dependency.

lloydjatkinson commented 3 years ago

Apparently the fix is: https://github.com/vuejs/vue-jest/issues/403#issuecomment-951492051

But my question is why is Vue CLI installing not just old but deprecated versions? For context, this problem was encountered on a project setup literally days ago.

kenberkeley commented 3 years ago

Thanks @lloydjatkinson a lot!

My original error trace for reference
[4/4] Building fresh packages...
[-/24] ⠁ waiting...
[9/24] ⠁ deasync
[3/24] ⠁ puppeteer
[10/24] ⠁ core-js-pure
error /opt/my-demo-project/node_modules/deasync: Command failed.
Exit code: 1
Command: node ./build.js
Arguments: 
Directory: /opt/my-demo-project/node_modules/deasync
Output:
gyp info it worked if it ends with ok
gyp info using node-gyp@8.2.0
gyp info using node@16.13.0 | linux | x64
gyp info find Python using Python version 3.8.5 found at "/usr/bin/python3"
gyp info spawn /usr/bin/python3
gyp info spawn args [
gyp info spawn args   '/usr/lib/node_modules/npm/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   '/opt/my-demo-project/node_modules/deasync/build/config.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/usr/lib/node_modules/npm/node_modules/node-gyp/addon.gypi',
gyp info spawn args   '-I',
gyp info spawn args   '/root/.cache/node-gyp/16.13.0/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/.cache/node-gyp/16.13.0',
gyp info spawn args   '-Dnode_gyp_dir=/usr/lib/node_modules/npm/node_modules/node-gyp',
gyp info spawn args   '-Dnode_lib_file=/root/.cache/node-gyp/16.13.0/<(target_arch)/node.lib',
gyp info spawn args   '-Dmodule_root_dir=/opt/my-demo-project/node_modules/deasync',
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 info spawn args ]
gyp info spawn make
gyp info spawn args [ 'BUILDTYPE=Release', '-C', 'build' ]
g++: error: unrecognized command line option '-std=gnu++14'
make: *** [Release/obj.target/deasync/src/deasync.o] Error 1
gyp ERR! build error 
gyp ERR! stack Error: `make` failed with exit code: 2
gyp ERR! stack     at ChildProcess.onExit (/usr/lib/node_modules/npm/node_modules/node-gyp/lib/build.js:194:23)
gyp ERR! stack     at ChildProcess.emit (node:events:390:28)
gyp ERR! stack     at Process.ChildProcess._handle.onexit (node:internal/child_process:290:12)
gyp ERR! System Linux 4.14.238-125.422.amzn1.x86_64
gyp ERR! command "/usr/bin/node" "/usr/lib/node_modules/npm/node_modules/node-gyp/bin/node-gyp.js" "rebuild"
gyp ERR! cwd /opt/my-demo-project/node_modules/deasync
gyp ERR! node -v v16.13.0
gyp ERR! node-gyp -v v8.2.0
gyp ERR! not ok 
Build failed
lloydjatkinson commented 3 years ago

So that fix doesn't work then?

kenberkeley commented 3 years ago

@lloydjatkinson It works! Thanks 😊