Skip to content

命令行工具在macOS系统下无法执行 #3

Open

Description

@huguangju

执行 npx iconfont-init,报错如下:

mini-program-iconfont/node_modules/.bin/iconfont-init: line 1: use strict: command not found
mini-program-iconfont/node_modules/.bin/iconfont-init: line 2: syntax error near unexpected token `exports,'
mini-program-iconfont/node_modules/.bin/iconfont-init: line 2: `Object.defineProperty(exports, "__esModule", { value: true });'

原因: .node_modules/bin/ 下的 node 脚本没有在文件开始写 Shebang 命令行,所以会被误为 shell 脚本执行而导致错误

解决:在文件头加上 #!/usr/bin/env node 即可

Activity

  1. fwh1990 commented on Sep 26, 2019

    @fwh1990
    Member

    之前是统一入口的是有加env,现在分路口,给漏了,抱歉,现在加上去

  2. fwh1990 commented on Sep 26, 2019

    @fwh1990
    Member

    发布了新版本 @huguangju

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions