kabiroberai / node-swift

Create Node modules in Swift
MIT License
492 stars 16 forks source link

Building Example Fails #30

Open btx-systems opened 4 months ago

btx-systems commented 4 months ago

I am trying to run the example provided in the repo. However I am facing an issue when running npm run install

I saw that there was a previous issue #29 with a similar error and I have tried running sudo xcode-select --reset but this did not work. Here is the console output of running npm run install

I am on MacOS 15 Beta 2 with swift 6.0

warning: 'example': <unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/Library/Developer/CommandLineTools/usr/bin/swift-driver-new'
[2/2] Initializing...
warning: 'example': <unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/Library/Developer/CommandLineTools/usr/bin/swift-driver-new'
error: Invalid manifest (compiled with: ["/Library/Developer/CommandLineTools/usr/bin/swiftc", "-vfsoverlay", "/var/folders/5m/27vchnzd71z2l_86qn8sj9800000gn/T/TemporaryDirectory.EsqCmt/vfs.yaml", "-L", "/Library/Developer/CommandLineTools/usr/lib/swift/pm/ManifestAPI", "-lPackageDescription", "-Xlinker", "-rpath", "-Xlinker", "/Library/Developer/CommandLineTools/usr/lib/swift/pm/ManifestAPI", "-target", "arm64-apple-macosx13.0", "-sdk", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", "-swift-version", "6", "-I", "/Library/Developer/CommandLineTools/usr/lib/swift/pm/ManifestAPI", "-sdk", "/Library/Developer/CommandLineTools/SDKs/MacOSX.sdk", "-package-description-version", "6.0.0", "/Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/Package@swift-6.0.swift", "-o", "/var/folders/5m/27vchnzd71z2l_86qn8sj9800000gn/T/TemporaryDirectory.AK1GQY/node-swift-manifest"])
<unknown>:0: warning: using (deprecated) legacy driver, Swift installation does not contain swift-driver at: '/Library/Developer/CommandLineTools/usr/bin/swift-driver-new'
/Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/Package@swift-6.0.swift:4:8: error: no such module 'CompilerPluginSupport'
 2 | 
 3 | import PackageDescription
 4 | import CompilerPluginSupport
   |        `- error: no such module 'CompilerPluginSupport'
 5 | import Foundation
 6 |
/Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/builder.js:259
                throw new Error(`swift build exited with status ${result.status}`);
                      ^

Error: swift build exited with status 1
    at Object.<anonymous> (/Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/builder.js:259:23)
    at Generator.next (<anonymous>)
    at /Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/builder.js:8:71
    at new Promise (<anonymous>)
    at __awaiter (/Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/builder.js:4:12)
    at Object.build (/Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/builder.js:60:12)
    at /Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/cli.js:61:23
    at Generator.next (<anonymous>)
    at /Users/jackfagan/Coding/YAFSR/node-swift/example/node_modules/node-swift/lib/cli.js:32:71
    at new Promise (<anonymous>)

Node.js v20.10.0
kabiroberai commented 3 months ago

Do you have Xcode installed? If you have Xcode and you're still getting this error, it could be in a non-standard location. What's the output of xcode-select -p, and does the output location exist? If not, try sudo xcode-select -s /path/to/Xcode.app.

jameshfisher commented 1 month ago

I had this issue. It was resolved by

sudo xcode-select -s /Applications/Xcode.app/Contents/Developer