NativeScript 安装时缺少写入访问错误

0 npm node-modules nativescript

当我尝试通过运行安装 nativescriptt 时npm i -g nativescript,收到以下错误:

    npm WARN checkPermissions Missing write access to 
    /usr/local/lib/node_modules/nativescript
    npm ERR! path /usr/local/lib/node_modules/nativescript
    npm ERR! code ENOENT
    npm ERR! errno -2
    npm ERR! syscall access
    npm ERR! enoent ENOENT: no such file or directory, access 
    '/usr/local/lib/node_modules/nativescript'
    npm ERR! enoent This is related to npm not being able to find a 
    file.
Run Code Online (Sandbox Code Playgroud)

我尝试以 sudo 身份运行该命令并收到相同的结果。我还尝试向该node_modules目录添加写权限。

我在 macOS High Sierra 上运行节点 v10.6.0。

Ang*_*oko 6

添加sudo命令以允许您以安全权限运行程序

sudo npm i -g nativescript
Run Code Online (Sandbox Code Playgroud)