Unexpected token '.' Error on npm install

Asked 1 years ago, Updated 1 years ago, 372 views

When I ran npm install at the Windows command prompt,
npm ERR!Unexpected token '.' stops processing.

There is a log output, but no information is available that might be related to the error.

0 verbose cli C:\Program Files\nodejs\node.exe C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js
1 info using [email protected]
2 info using [email protected]
3 timing npm:load:whichnodeCompleted in 0ms
4 timing config:load:defaults Completed in 2ms
5 timing config:load:file:C:\Users\owner\AppData\Roaming\nvm\v16.19.0\node_modules\npm\npmrc Completed in 1ms
6 timing config:load:buildin Completed in 1ms
7 timing config:load:cli Completed in 1ms
8 timing config:load:env Completed in 1ms
9 timing config:load:file:c:\web\010_electron\.npmrc Completed in 0ms
10 timing config:load:project Completed in 1ms
11 timing config:load:file:C:\Users\owner\.npmrc Completed in 0ms
12 timing config:load:user Completed in 0ms
13 timing config:load:file:C:\Program Files\nodejs\etc\npmrc Completed in 0ms
14 timing config:load:global Completed in 1ms
15 timing config:load:validate Completed in 0ms
16 timing config:load:credentials Completed in 1ms
17 timing config:load:setEnvs Completed in 1ms
18 timing config: load Completed in 9 ms
19 timing npm:load:configload Completed in 9ms
20 timing npm:load:mkdirpcache Completed in 0ms
21 timing npm:load:mkdirplogs Completed in 0ms
22 verbose title npm update
23 verbose argv "update"
24 timing npm:load:setTitle Completed in 1ms
25 timing config:load:flatten Completed in 3ms
26 timing npm:load:display Completed in 4ms
27 verbose logfile logs-max: 10 dir: C:\Users\owner\AppData\Local\npm-cache\_logs
28 verbose logfile C:\Users\owner\AppData\Local\npm-cache\_logs\2022-12-20T23_39_53_311Z-debug-0.log
29 timing npm:load:logFileCompleted in 6ms
30 timing npm:load:timers Completed in 0ms
31 timing npm:load:configScope Completed in 0ms
32 timing npm: load Completed in 21ms
33 verbose stack C:\Users\owner\AppData\Roaming\nvm\v16.19.0\node_modules\npm\node_modules\@npmcli\arborist:1
33 verbose stack../../workspaces/arborist
33 verbose stack^
33 verbose stack
33 verbose stack SyntaxError: Unexpected token '.'
33 verbose stack at Object.compileFunction (node:vm:360:18)
33 verbose stack at wrapSafe (node: internal/modules/cjs/loader: 1094:15)
33 verbose stack at Module._compile(node:internal/modules/cjs/loader:1129:27)
33 verbose stack at Object.Module._extensions..js(node:internal/modules/cjs/loader:1219:10)
33 verbose stack at Module.load (node: internal/modules/cjs/loader: 1043:32)
33 verbose stack at Function.Module._load (node:internal/modules/cjs/loader:878:12)
33 verbose stack at Module.require (node: internal/modules/cjs/loader: 1067:19)
33 verbose stack at require (node:internal/modules/cjs/helpers:103:18)
33 verbose stack at Object.<anonymous> (C:\Users\owner\AppData\Roaming\nvm\v16.19.0\node_modules\npm\lib\commands\update.js:3:18)
33 verbose stack at Module._compile(node:internal/modules/cjs/loader:1165:14)
34 verbose cwd c:\web\010_electron
35 verbose Windows_NT 10.0.22000
36 verbose node v16.19.0
37 verbose npm v8.19.3
38 error Unexpected token '.'
39 verbose exit 1
40 timing npm Completed in 31ms
41 verbose code 1
42 error A complete log of this run can be found in:
42 error C:\Users\owner\AppData\Local\npm-cache\_logs\2022-12-20T23_39_53_311Z-debug-0.log

Your current environment is as follows:
npm 8.19.3
nvm1.1.10
node.js16.19.0

There was a post saying that it occurs when the nvm-windows version is 1.1.7, but
I am currently using 1.1.10.

What else could be the cause?

windows npm

2022-12-22 02:43

1 Answers

It was resolved by uninstalling and reinstalling node once.
(I received your advice in the comments)

Uninstall nvm from Add/Remove Programs
"In the middle, ""All nodes will be deleted"" will be displayed, so ""yes""

"

Reinstall nvm in nvm-setup.exe after rebooting the computer


2022-12-22 05:44

If you have any answers or tips


© 2024 OneMinuteCode. All rights reserved.