我已尝试关注steps mentioned in the TypeScriptLang.org,但我无法下载打字稿。
以下是我尝试的内容:
mkotsollariss-MacBook-Pro:/ mkotsollaris$ which node
/usr/local/bin/node
mkotsollariss-MacBook-Pro:/ mkotsollaris$ which npm
/usr/local/bin/npm
mkotsollariss-MacBook-Pro:/ mkotsollaris$ npm install -g typescript
npm WARN checkPermissions Missing write access to /usr/local/lib/node_modules
/usr/local/lib
└── typescript@2.1.5
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "typescript"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! path /usr/local/lib/node_modules
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall access
npm ERR! Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, access '/usr/local/lib/node_modules'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'access',
npm ERR! path: '/usr/local/lib/node_modules' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Darwin 16.3.0
npm ERR! argv "/usr/local/bin/node" "/usr/local/bin/npm" "install" "-g" "typescript"
npm ERR! node v6.9.4
npm ERR! npm v3.10.10
npm ERR! path npm-debug.log.3182471724
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall open
npm ERR! Error: EACCES: permission denied, open 'npm-debug.log.3182471724'
npm ERR! at Error (native)
npm ERR! { Error: EACCES: permission denied, open 'npm-debug.log.3182471724'
npm ERR! at Error (native)
npm ERR! errno: -13,
npm ERR! code: 'EACCES',
npm ERR! syscall: 'open',
npm ERR! path: 'npm-debug.log.3182471724' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.
npm ERR! Please include the following file with any support request:
npm ERR! /npm-debug.log
mkotsollariss-MacBook-Pro:/ mkotsollaris$
当我sudo打字稿时安装:
mkotsollariss-MacBook-Pro:/ mkotsollaris$ sudo npm install -g typescript
Password:
/Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/bin/tsc -> /Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/lib/node_modules/typescript/bin/tsc
/Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/bin/tsserver -> /Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/lib/node_modules/typescript/bin/tsserver
/Applications/IBM/SoftwareDeliveryPlatform_1/cordova_cli/lib
└── typescript@2.1.5
mkotsollariss-MacBook-Pro:/ mkotsollaris$ which tsc
mkotsollariss-MacBook-Pro:/ mkotsollaris$ tsc
-bash: tsc: command not found
mkotsollariss-MacBook-Pro:/ mkotsollaris$
有什么想法吗?
答案 0 :(得分:3)
我认为您的用户权限遇到了麻烦。看看这个链接:
https://docs.npmjs.com/getting-started/fixing-npm-permissions