当我在我的文件夹中运行npm create svelte@latest
应用程序时,我收到此错误。
node:internal/errors:490
ErrorCaptureStackTrace(err);
^
Error [ERR_MODULE_NOT_FOUND]: Cannot find module 'C:\Users\PC\AppData\Local\npm-cache\_npx\50a6160ffc29bafc\node_modules\create-svelte\index.js' imported from C:\Users\PC\AppData\Local\npm-cache\_npx\50a6160ffc29bafc\node_modules\create-svelte\bin.js
at new NodeError (node:internal/errors:399:5)
at finalizeResolution (node:internal/modules/esm/resolve:326:11)
at moduleResolve (node:internal/modules/esm/resolve:945:10)
at defaultResolve (node:internal/modules/esm/resolve:1153:11)
at nextResolve (node:internal/modules/esm/loader:163:28)
at ESMLoader.resolve (node:internal/modules/esm/loader:838:30)
at ESMLoader.getModuleJob (node:internal/modules/esm/loader:424:18)
at ModuleWrap.<anonymous> (node:internal/modules/esm/module_job:77:40)
at link (node:internal/modules/esm/module_job:76:36) {
code: 'ERR_MODULE_NOT_FOUND'
}
Node.js v18.16.0
npm ERR! code 1
npm ERR! path C:\Users\PC\Documents\Project Eduards
npm ERR! command failed
npm ERR! command C:\Windows\system32\cmd.exe /d /s /c create-svelte app
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\PC\AppData\Local\npm-cache\_logs\2023-05-07T04_43_14_156Z-debug-0.log
原木看起来是这样的
0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using npm@9.5.1
2 info using node@v18.16.0
3 timing npm:load:whichnode Completed in 2ms
4 timing config:load:defaults Completed in 1ms
5 timing config:load:file:C:\Program Files\nodejs\node_modules\npm\npmrc Completed in 2ms
6 timing config:load:builtin Completed in 2ms
7 timing config:load:cli Completed in 3ms
8 timing config:load:env Completed in 0ms
9 timing config:load:file:C:\Users\PC\Documents\Project Eduards\.npmrc Completed in 0ms
10 timing config:load:project Completed in 3ms
11 timing config:load:file:C:\Users\PC\.npmrc Completed in 0ms
12 timing config:load:user Completed in 1ms
13 timing config:load:file:C:\Users\PC\AppData\Roaming\npm\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 0ms
15 timing config:load:setEnvs Completed in 1ms
16 timing config:load Completed in 12ms
17 timing npm:load:configload Completed in 14ms
18 timing npm:load:mkdirpcache Completed in 0ms
19 timing npm:load:mkdirplogs Completed in 1ms
20 verbose title npm create svelte@latest app
21 verbose argv "create" "svelte@latest" "app"
22 timing npm:load:setTitle Completed in 1ms
23 timing config:load:flatten Completed in 4ms
24 timing npm:load:display Completed in 8ms
25 verbose logfile logs-max:10 dir:C:\Users\PC\AppData\Local\npm-cache\_logs\2023-05-07T04_43_14_156Z-
26 verbose logfile C:\Users\PC\AppData\Local\npm-cache\_logs\2023-05-07T04_43_14_156Z-debug-0.log
27 timing npm:load:logFile Completed in 6ms
28 timing npm:load:timers Completed in 1ms
29 timing npm:load:configScope Completed in 0ms
30 timing npm:load Completed in 33ms
31 silly logfile start cleaning logs, removing 2 files
32 timing arborist:ctor Completed in 1ms
33 silly logfile done cleaning log files
34 http fetch GET 200 https://registry.npmjs.org/create-svelte 1229ms (cache revalidated)
35 timing arborist:ctor Completed in 0ms
36 timing arborist:ctor Completed in 0ms
37 timing command:create Completed in 1577ms
38 verbose stack Error: command failed
38 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\@npmcli\promise-spawn\lib\index.js:53:27)
38 verbose stack at ChildProcess.emit (node:events:513:28)
38 verbose stack at maybeClose (node:internal/child_process:1091:16)
38 verbose stack at ChildProcess._handle.onexit (node:internal/child_process:302:5)
39 verbose cwd C:\Users\PC\Documents\Project Eduards
40 verbose Windows_NT 10.0.18363
41 verbose node v18.16.0
42 verbose npm v9.5.1
43 error code 1
44 error path C:\Users\PC\Documents\Project Eduards
45 error command failed
46 error command C:\Windows\system32\cmd.exe /d /s /c create-svelte app
47 verbose exit 1
48 timing npm Completed in 1674ms
49 verbose code 1
50 error A complete log of this run can be found in:
50 error C:\Users\PC\AppData\Local\npm-cache\_logs\2023-05-07T04_43_14_156Z-debug-0.log
我尝试重新安装nodejs并重新启动我的电脑,但这不起作用。
1条答案
按热度按时间ni65a41a1#
这可能是npx的缓存安装的问题。考虑转到
'C:\Users\PC\AppData\Local\npm-cache\_npx'
上的AppData,删除npx
文件夹,然后尝试npm create svelte@latest
。希望能帮上忙。