我开始学习打字稿,然后关闭计算机并打开计算机后,似乎将其删除了,因为它根本不知道tsc命令。现在每次安装都会失败。
i我尝试使用“ sudo”运行命令,然后重新安装node和npm。
错误日志:
0 info it worked if it ends with ok
1 verbose cli [ '/usr/local/bin/node',
1 verbose cli '/usr/local/bin/npm',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'typescript' ]
2 info using npm@6.4.1
3 info using node@v10.15.0
4 verbose npm-session 5326ab3176ead173
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/typescript 1062ms
8 silly pacote tag manifest for typescript@latest fetched in 1096ms
9 timing stage:loadCurrentTree Completed in 1296ms
10 silly install loadIdealTree
11 silly install cloneCurrentTreeToIdealTree
12 timing stage:loadIdealTree:cloneCurrentTree Completed in 0ms
13 silly install loadShrinkwrap
14 timing stage:loadIdealTree:loadShrinkwrap Completed in 1ms
15 silly install loadAllDepsIntoIdealTree
16 silly resolveWithNewModule typescript@3.2.4 checking installable status
17 timing stage:loadIdealTree:loadAllDepsIntoIdealTree Completed in 5ms
18 timing stage:loadIdealTree Completed in 6ms
19 silly currentTree lib
20 silly idealTree lib
20 silly idealTree └── typescript@3.2.4
21 silly install generateActionsToTake
22 warn checkPermissions Missing write access to /usr/local/lib/node_modules
23 timing stage:rollbackFailedOptional Completed in 0ms
24 timing stage:runTopLevelLifecycles Completed in 1307ms
25 verbose stack Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
26 verbose cwd /Users/user
27 verbose Darwin 18.2.0
28 verbose argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "typescript"
29 verbose node v10.15.0
30 verbose npm v6.4.1
31 error path /usr/local/lib/node_modules
32 error code EACCES
33 error errno -13
34 error syscall access
35 error Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
35 error { [Error: EACCES: permission denied, access '/usr/local/lib/node_modules']
35 error stack:
35 error 'Error: EACCES: permission denied, access \'/usr/local/lib/node_modules\'',
35 error errno: -13,
35 error code: 'EACCES',
35 error syscall: 'access',
35 error path: '/usr/local/lib/node_modules' }
36 error The operation was rejected by your operating system.
36 error It is likely you do not have the permissions to access this file as the current user
36 error
36 error If you believe this might be a permissions issue, please double-check the
36 error permissions of the file and its containing directories, or try running
36 error the command again as root/Administrator (though this is not recommended).
37 verbose exit [ -13, true ]
现在,我找不到其他解决方案。
非常感谢。