Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

preinstall script breaks pnp installation silently in yarn workspaces #6513

Closed
bugzpodder opened this issue Oct 7, 2018 · 2 comments
Closed
Assignees

Comments

@bugzpodder
Copy link
Contributor

clone https://github.com/bradfordlemley/cra-monorepo-examples
use plug-n-play: yarn --pnp
goto a apps/cra-app1
add a preinstall script:

+++ b/apps/cra-app1/package.json
@@ -5,13 +5,14 @@
   "dependencies": {
     "react": "^16.2.0",
     "react-dom": "^16.2.0",
-    "react-scripts": "2.0.0-next.b2fd8db8"
+    "react-scripts": "2.0.4"
   },
   "scripts": {
     "start": "react-scripts start",
     "build": "react-scripts build",
     "test": "react-scripts test --env=jsdom",
-    "eject": "react-scripts eject"
+    "eject": "react-scripts eject",
+    "preinstall": "node -e 'if(!/yarn\\.js$/.test(process.env.npm_execpath))throw new Error(\"Use yarn install\")'"
   },
   "browserslist": {
     "development": [

run yarn in workspace root, see no obivous errors
run yarn app1 see react-scripts not found
run yarn app2 and it works fine.

@arcanis

@ghost ghost assigned torifat Oct 7, 2018
@ghost ghost added the triaged label Oct 7, 2018
@bugzpodder
Copy link
Contributor Author

bugzpodder commented Oct 7, 2018

This is super annoying, I have another directory that doesn't have the executables (ie babel/eslint) working and I have no idea why. need to remove stuff from package.json piece by piece until I find the culprit.

it appears to be caused by postinstall scripts (node-sass, cypress, etc). --ignore-scripts doesn't really work for some reason. Deleting these dependencies make it work.

@arcanis
Copy link
Member

arcanis commented Oct 10, 2018

Woops - we automatically unplug the packages that have {pre/post}install scripts (since otherwise they would get built inside the cache, which could lead to cache corruptions). I forgot to prevent this from happening with workspaces.

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

No branches or pull requests

3 participants