Skip to content

TypeError: proj.addSourceFileNew is not a functionΒ #1

@clarsen

Description

@clarsen

Using [email protected] (which isn't pushed to your repo by the way πŸ˜„ )
Invoking react-native link react-native-swift results in the below.

Writing to  .../ios/RNPlaceholder.swift
.../node_modules/react-native-swift/bin/postlink.js:43
proj.addSourceFileNew(placeholder);
     ^

TypeError: proj.addSourceFileNew is not a function
    at Object.<anonymous> (.../node_modules/react-native-swift/bin/postlink.js:43:6)
    at Module._compile (internal/modules/cjs/loader.js:688:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:699:10)
    at Module.load (internal/modules/cjs/loader.js:598:32)
    at tryModuleLoad (internal/modules/cjs/loader.js:537:12)
    at Function.Module._load (internal/modules/cjs/loader.js:529:3)
    at Function.Module.runMain (internal/modules/cjs/loader.js:741:12)
    at startup (internal/bootstrap/node.js:285:19)
    at bootstrapNodeJSCore (internal/bootstrap/node.js:739:3)
.../node_modules/react-native/local-cli/core/makeCommand.js:32
        throw new Error(`Error occurred during executing "${command}" command`);
        ^

Error: Error occurred during executing "node node_modules/react-native-swift/bin/postlink.js" command
    at ChildProcess.prelink (...2/node_modules/react-native/local-cli/core/makeCommand.js:32:15)
    at ChildProcess.emit (events.js:182:13)
    at maybeClose (internal/child_process.js:962:16)
    at Process.ChildProcess._handle.onexit (internal/child_process.js:251:5)

I think you might be picking up the default/global installed 'xcode' via

var pbxproj = require("xcode");

instead of

var pbxproj = require('@raydeck/xcode');

In any case, making that patch stops the error.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions