Npm测试运行失败

时间:2018-07-18 10:37:56

标签: node.js npm create-react-app

我已经使用带有脚本脚本的create-react-app创建了一个项目。 'npm start'正常工作,但是当我尝试运行'npm run test'时,它就这样失败了(完整日志):

0 info it worked if it ends with ok
1 verbose cli [ 'c:\\tools\\nodejs\\6.9.1\\node.exe',
1 verbose cli   'c:\\tools\\nodejs\\6.9.1\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli   'run',
1 verbose cli   'test' ]
2 info using npm@3.10.8
3 info using node@v6.9.1
4 verbose run-script [ 'pretest', 'test', 'posttest' ]
5 info lifecycle pspm-frontend-typescript@0.1.0~pretest: pspm-frontend-typescript@0.1.0
6 silly lifecycle pspm-frontend-typescript@0.1.0~pretest: no script for pretest, continuing
7 info lifecycle pspm-frontend-typescript@0.1.0~test: pspm-frontend-typescript@0.1.0
8 verbose lifecycle pspm-frontend-typescript@0.1.0~test: unsafe-perm in lifecycle true
9 verbose lifecycle pspm-frontend-typescript@0.1.0~test: PATH: c:\tools\nodejs\6.9.1\node_modules\npm\bin\node-gyp-bin;C:\Users\M013435\WebstormProjects\pspm-frontend-typescript\node_modules\.bin;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\oraclexe\app\oracle\product\11.2.0\server\bin;;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;;c:/tools\devtool\1.37\bin;c:/tools\git\2.13.2\bin;c:/tools\winpython\2.7.12.4\scripts;c:/tools\curl\7.56.1\bin;c:/tools\maven\3.5.2\bin;c:/tools\jdk\1.8.152.64\bin;c:/tools\yarn\1.0.2\bin;c:/tools\gradle\4.3.1\bin;;c:/tools\nodejs\6.9.1\.;
10 verbose lifecycle pspm-frontend-typescript@0.1.0~test: CWD: C:\Users\M013435\WebstormProjects\pspm-frontend-typescript
11 silly lifecycle pspm-frontend-typescript@0.1.0~test: Args: [ '/d /s /c', 'react-scripts-ts test --env=jsdom' ]
12 silly lifecycle pspm-frontend-typescript@0.1.0~test: Returned: code: 1  signal: null
13 info lifecycle pspm-frontend-typescript@0.1.0~test: Failed to exec test script
14 verbose stack Error: pspm-frontend-typescript@0.1.0 test: `react-scripts-ts test --env=jsdom`
14 verbose stack Exit status 1
14 verbose stack     at EventEmitter.<anonymous> (c:\tools\nodejs\6.9.1\node_modules\npm\lib\utils\lifecycle.js:255:16)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at EventEmitter.emit (events.js:191:7)
14 verbose stack     at ChildProcess.<anonymous> (c:\tools\nodejs\6.9.1\node_modules\npm\lib\utils\spawn.js:40:14)
14 verbose stack     at emitTwo (events.js:106:13)
14 verbose stack     at ChildProcess.emit (events.js:191:7)
14 verbose stack     at maybeClose (internal/child_process.js:877:16)
14 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:226:5)
15 verbose pkgid pspm-frontend-typescript@0.1.0
16 verbose cwd C:\Users\M013435\WebstormProjects\pspm-frontend-typescript
17 error Windows_NT 6.1.7601
18 error argv "c:\\tools\\nodejs\\6.9.1\\node.exe" "c:\\tools\\nodejs\\6.9.1\\node_modules\\npm\\bin\\npm-cli.js" "run" "test"
19 error node v6.9.1
20 error npm  v3.10.8
21 error code ELIFECYCLE
22 error pspm-frontend-typescript@0.1.0 test: `react-scripts-ts test --env=jsdom`
22 error Exit status 1
23 error Failed at the pspm-frontend-typescript@0.1.0 test script 'react-scripts-ts test --env=jsdom'.
23 error Make sure you have the latest version of node.js and npm installed.
23 error If you do, this is most likely a problem with the pspm-frontend-typescript package,
23 error not with npm itself.
23 error Tell the author that this fails on your system:
23 error     react-scripts-ts test --env=jsdom
23 error You can get information on how to open an issue for this project with:
23 error     npm bugs pspm-frontend-typescript
23 error Or if that isn't available, you can get their info via:
23 error     npm owner ls pspm-frontend-typescript
23 error There is likely additional logging output above.
24 verbose exit [ 1, true ]

对我来说不是很描述。我的节点版本是6.9.1,npm是3.10.8。我已将节点更新到版本9,并更新了npm。我还尝试清理npm缓存并删除node_modules,但错误仍然存​​在。

1 个答案:

答案 0 :(得分:0)

因此出于某种原因,它想要一个git repo。使用git repo初始化后,它可以正常工作。