npm install -g @ionic/cli 意外的标记 '.'
npm install -g @ionic/cli Unexpected token '.'
我想在我的系统上安装 ionic 6。我已经使用 nvm 在我的系统上安装了多个版本的 npm。
nvm ls
D:\<user_name>\Projects\Ionic-6>nvm ls
* 16.14.2 (Currently using 64-bit executable)
16.14.0
16.13.1
14.17.3
12.19.0
10.0.0
8.9.4
当我 运行 npm install -g @ionic/cli
我遇到以下错误:
D:\<user_name>\Projects\Ionic-6>npm install -g @ionic/cli
npm ERR! Unexpected token '.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\<user_name>\AppData\Local\npm-cache\_logs22-04-01T11_25_55_752Z-debug-0.log
错误日志
27 verbose stack C:\Users\<user_name>\AppData\Roaming\nvm\v16.14.2\node_modules\npm\node_modules\libnpmfund:1
27 verbose stack ../workspaces/libnpmfund
27 verbose stack ^
27 verbose stack
27 verbose stack SyntaxError: Unexpected token '.'
27 verbose stack at Object.compileFunction (node:vm:352:18)
27 verbose stack at wrapSafe (node:internal/modules/cjs/loader:1032:15)
27 verbose stack at Module._compile (node:internal/modules/cjs/loader:1067:27)
27 verbose stack at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
27 verbose stack at Module.load (node:internal/modules/cjs/loader:981:32)
27 verbose stack at Function.Module._load (node:internal/modules/cjs/loader:822:12)
27 verbose stack at Module.require (node:internal/modules/cjs/loader:1005:19)
27 verbose stack at require (node:internal/modules/cjs/helpers:102:18)
27 verbose stack at Object.<anonymous> (C:\Users\<user_name>\AppData\Roaming\nvm\v16.14.2\node_modules\npm\lib\utils\reify-output.js:16:38)
27 verbose stack at Module._compile (node:internal/modules/cjs/loader:1103:14)
28 verbose cwd D:\
29 verbose Windows_NT 10.0.19041
30 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "@ionic/cli"
31 verbose node v16.14.2
32 verbose npm v8.5.0
33 error Unexpected token '.'
34 verbose exit 1
35 timing npm Completed in 683ms
36 verbose code 1
37 error A complete log of this run can be found in:
37 error C:\Users\<user_name>\AppData\Local\npm-cache\_logs22-04-01T11_17_49_197Z-debug-0.log
我通过安装最新版本 nvm-windows
解决了这个问题
我想在我的系统上安装 ionic 6。我已经使用 nvm 在我的系统上安装了多个版本的 npm。
nvm ls
D:\<user_name>\Projects\Ionic-6>nvm ls
* 16.14.2 (Currently using 64-bit executable)
16.14.0
16.13.1
14.17.3
12.19.0
10.0.0
8.9.4
当我 运行 npm install -g @ionic/cli
我遇到以下错误:
D:\<user_name>\Projects\Ionic-6>npm install -g @ionic/cli
npm ERR! Unexpected token '.'
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\<user_name>\AppData\Local\npm-cache\_logs22-04-01T11_25_55_752Z-debug-0.log
错误日志
27 verbose stack C:\Users\<user_name>\AppData\Roaming\nvm\v16.14.2\node_modules\npm\node_modules\libnpmfund:1
27 verbose stack ../workspaces/libnpmfund
27 verbose stack ^
27 verbose stack
27 verbose stack SyntaxError: Unexpected token '.'
27 verbose stack at Object.compileFunction (node:vm:352:18)
27 verbose stack at wrapSafe (node:internal/modules/cjs/loader:1032:15)
27 verbose stack at Module._compile (node:internal/modules/cjs/loader:1067:27)
27 verbose stack at Object.Module._extensions..js (node:internal/modules/cjs/loader:1157:10)
27 verbose stack at Module.load (node:internal/modules/cjs/loader:981:32)
27 verbose stack at Function.Module._load (node:internal/modules/cjs/loader:822:12)
27 verbose stack at Module.require (node:internal/modules/cjs/loader:1005:19)
27 verbose stack at require (node:internal/modules/cjs/helpers:102:18)
27 verbose stack at Object.<anonymous> (C:\Users\<user_name>\AppData\Roaming\nvm\v16.14.2\node_modules\npm\lib\utils\reify-output.js:16:38)
27 verbose stack at Module._compile (node:internal/modules/cjs/loader:1103:14)
28 verbose cwd D:\
29 verbose Windows_NT 10.0.19041
30 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "install" "-g" "@ionic/cli"
31 verbose node v16.14.2
32 verbose npm v8.5.0
33 error Unexpected token '.'
34 verbose exit 1
35 timing npm Completed in 683ms
36 verbose code 1
37 error A complete log of this run can be found in:
37 error C:\Users\<user_name>\AppData\Local\npm-cache\_logs22-04-01T11_17_49_197Z-debug-0.log
我通过安装最新版本 nvm-windows
解决了这个问题