我想为 Jest 使用 Vue 单元测试实用程序。这在 Windows 上运行良好,但在 Linux 上出现错误。
这就是我所做的:
vue create my-project
- 选择
Manually select features
- 选择
Choose vue version
- 取消选择
Babel
- 选择
Typescript
- 选择
Linter / Formatter
- 选择
Unit Testing
- 进入
- 选择
3.x (preview)
- 回答'y'
Class-style component syntax
- 回答“n”
Use Babel alongside ...
Pick a linter
: 选择ESLint + standard config
Pick additional lint features
: 选择Lint on save
Pick a unit testing solution
: 选择jest
Where do you prefer placing config
: 选择In package.json
- 回答“n”
Save this as a preset for future projects?
然后它尝试使用以下输出创建项目:
Vue CLI v4.5.10
✨ Creating project in /home/admiraal/my-project.
Initializing git repository...
⚙️ Installing CLI plugins. This might take a while...
npm ERR! code 1
npm ERR! path /home/admiraal/my-project/node_modules/deasync
npm ERR! command failed
npm ERR! command sh -c node ./build.js
npm ERR! `linux-x64-node-15` exists; testing
npm ERR! Problem with the binary; manual build incoming
npm ERR! stdout=
npm ERR! err=Error: Command failed: /home/admiraal/.nvm/versions/node/v15.5.1/bin/node quick-test.js
npm ERR! /home/admiraal/my-project/node_modules/bindings/bindings.js:135
npm ERR! throw err;
npm ERR! ^
npm ERR!
npm ERR! Error: Could not locate the bindings file. Tried:
npm ERR! → /home/admiraal/my-project/node_modules/deasync/build/deasync.node
npm ERR! → /home/admiraal/my-project/node_modules/deasync/build/Debug/deasync.node
...
(many "npm ERR!" lines follow)
当我尝试将 Jest 添加到现有的成功创建的项目中时,会出现相同的错误
vue add unit-jest
卸载并重新安装 deasync 并不能解决问题。