meteor / meteor

Meteor, the JavaScript App Platform
https://meteor.com
Other
44.46k stars 5.2k forks source link

Unable to build project, isobuild has error: `EACCES: permission denied, open ...` #12952

Open trusktr opened 11 months ago

trusktr commented 11 months ago

Meteor 2.12

macOS

I am unable to run/build a project, I get an EACCES error from isobuild:

> meteor --exclude-archs web.browser.legacy -p 8765

[[[[[ ~/src/lume+lume/apps/website ]]]]]      

=> Started proxy.                             
=> Started HMR server.                        
=> Meteor 2.14 is available. Check the changelog https://docs.meteor.com/changelog.html and update this project with 'meteor update'.
=> Started MongoDB.                           
/Users/trusktr/.meteor/packages/meteor-tool/.2.12.0.1agbg9i.21x8++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/meteor-promise/promise_server.js:218
      throw error;
      ^

Error: EACCES: permission denied, open '/Users/trusktr/src/lume+lume/apps/website/.meteor/local/.build791258.build/programs/.build918003.web.browser/app/App.js'
    at Object.openSync (fs.js:498:3)
    at Object.writeFileSync (fs.js:1529:35)
    at Object.writeFile (/Users/trusktr/.meteor/packages/meteor-tool/.2.12.0.1agbg9i.21x8++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/tools/fs/tools/fs/files.ts:1522:23)
    at Builder.write (/tools/isobuild/builder.js:333:17)
    at /tools/isobuild/bundler.js:2871:11
    at /tools/isobuild/bundler.js:1796:9
    at /tools/isobuild/bundler.js:1718:11
    at Array.forEach (<anonymous>)
    at /tools/isobuild/bundler.js:1717:20
    at Array.forEach (<anonymous>)
    at ClientTarget.<anonymous> (/tools/isobuild/bundler.js:1716:30)
    at ClientTarget.write (/tools/isobuild/bundler.js:1750:5)
    at /tools/isobuild/bundler.js:2949:30
    at /tools/isobuild/bundler.js:3088:11
    at Array.forEach (<anonymous>)
    at /tools/isobuild/bundler.js:3083:26
    at /tools/isobuild/bundler.js:3456:22
    at Object.capture (/tools/utils/buildmessage.js:283:5)
    at bundle (/tools/isobuild/bundler.js:3262:31)
    at /tools/isobuild/bundler.js:3205:32
    at Slot.withValue (/Users/trusktr/.meteor/packages/meteor-tool/.2.12.0.1agbg9i.21x8++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/dev_bundle/lib/node_modules/@wry/context/lib/context.esm.js:69:29)
    at Object.withCache (/Users/trusktr/.meteor/packages/meteor-tool/.2.12.0.1agbg9i.21x8++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/tools/fs/tools/fs/files.ts:1543:39)
    at Object.bundle (/tools/isobuild/bundler.js:3205:16)
    at /tools/runners/run-app.js:579:24
    at Function.run (/Users/trusktr/.meteor/packages/meteor-tool/.2.12.0.1agbg9i.21x8++os.osx.arm64+web.browser+web.browser.legacy+web.cordova/mt-os.osx.arm64/tools/tool-env/tools/tool-env/profile.ts:289:14)
    at bundleApp (/tools/runners/run-app.js:578:34)
    at AppRunner._runOnce (/tools/runners/run-app.js:625:35)
    at AppRunner._fiber (/tools/runners/run-app.js:947:28)
    at /tools/runners/run-app.js:408:12 {
  errno: -13,
  syscall: 'open',
  code: 'EACCES',
  path: '/Users/trusktr/src/lume+lume/apps/website/.meteor/local/.build791258.build/programs/.build918003.web.browser/app/App.js'
}

It is similar to this issue in the forums:

https://forums.meteor.com/t/error-eacces-permission-denied-rename/57536

Reproduction:

git clone git@github.com:lume/lume.git
cd lume
git checkout meteor-issue-12952
npm run fresh # this checks out git submodules, installs dependencies, and links projects together
cd apps/website/ # this is the meteor app
npm start # runs meteor, causes error

This will cause the above error.

trusktr commented 11 months ago

This is related to the ecmascript package. When I comment out the package in .meteor/packages, this error goes away, and the server runs fine (it has no import statements in it), but of course the client won't work.

I am able to work around the client not working by removing the few import statements and instead using Package.* to get dependencies in client/entry.ts (compiled to client/entry.js).

The rest of the client is plain vanilla ES modules located inside public/, so no issues with that code, its the browser handling everything at that point (nice!).

I've not had any luck getting native ES modules working yet here:

https://forums.meteor.com/t/attempt-to-import-native-es-modules-in-meteor-3-0-beta-0-no-luck-yet/61085

trusktr commented 11 months ago

Sidenote, this problem is caused when projects in the reproduction's super module repo (similar to a monorepo, but I'm using git submodules to pull in all the packages) are symlinked together with Yarn. This error goes away when things are not symlinked.

TLDR: this might show a problem with isobuild and handling symlinked dependencies in node_modules.