question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. ItΒ collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Can't install / run in Yarn workspace

See original GitHub issue

Description

When I create a Yarn workspace and try to use create-react-native-app in it it installs all of the initial dependencies and hoists them to the root directory, but then it errors.

If I create the app in another folder outside of the project and copy/paste the contents back into the workspace and run yarn install everything seems to run ok, but then yarn start doesn’t work.

Expected Behavior

Running create-react-native-app in a Yarn workspace should install and run without errors with hoisted dependencies

Observed Behavior

Using package manager as yarnpkg with yarn interface.                                               
Installing packages. This might take a couple minutes.                                              
Installing react-native-scripts...                                                                  
                                                                                                    
yarn add v0.27.5                                                                                    
info No lockfile found.                                                                             
[1/4] Resolving packages...                                                                         
warning react-native-scripts > xdl > auth0-js > xtend > object-keys@0.4.0:                          
[2/4] Fetching packages...                                                                          
[3/4] Linking dependencies...                                                                       
warning "react-redux@5.0.5" has unmet peer dependency "react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0".    
[4/4] Building fresh packages...                                                                    
success Saved lockfile.                                                                             
success Saved 296 new dependencies.                                                                 
β”œβ”€ @ccheever/crayon@5.0.0                                                                           
β”œβ”€ @expo/bunyan@1.8.10                                                                              
β”œβ”€ @expo/json-file@5.3.0                                                                            
β”œβ”€ @expo/osascript@1.8.0                                                                            
β”œβ”€ @expo/spawn-async@1.3.0                                                                          
β”œβ”€ @segment/loosely-validate-event@1.1.2                                                            
β”œβ”€ accepts@1.3.3                                                                                    
β”œβ”€ ajv@4.11.8                                                                                       
β”œβ”€ analytics-node@2.4.1                                                                             
β”œβ”€ ansi-escapes@2.0.0                                                                               
β”œβ”€ ansi-regex@3.0.0                                                                                 
β”œβ”€ ansi-styles@3.2.0                                                                                
β”œβ”€ any-promise@1.3.0                                                                                
β”œβ”€ array-flatten@1.1.1                                                                              
β”œβ”€ asap@2.0.6                                                                                       
β”œβ”€ asn1@0.2.3                                                                                       
β”œβ”€ assert-plus@1.0.0                                                                                
β”œβ”€ async@1.5.2                                                                                      
β”œβ”€ asynckit@0.4.0                                                                                   
β”œβ”€ auth0-js@7.6.1                                                                                   
β”œβ”€ auth0@2.7.0                                                                                      
β”œβ”€ aws-sign2@0.6.0                                                                                  
β”œβ”€ aws4@1.6.0                                                                                       
β”œβ”€ babel-runtime@6.25.0                                                                             
β”œβ”€ balanced-match@1.0.0                                                                             
β”œβ”€ Base64@0.1.4                                                                                     
β”œβ”€ base64url@2.0.0                                                                                  
β”œβ”€ bcrypt-pbkdf@1.0.1                                                                               
β”œβ”€ block-stream@0.0.9                                                                               
β”œβ”€ bluebird@2.11.0                                                                                  
β”œβ”€ body-parser@1.17.2                                                                               
β”œβ”€ boom@2.10.1                                                                                      
β”œβ”€ brace-expansion@1.1.8                                                                            
β”œβ”€ buffer-equal-constant-time@1.0.1                                                                 
β”œβ”€ bytes@2.4.0                                                                                      
β”œβ”€ callsite@1.0.0                                                                                   
β”œβ”€ camel-case@1.2.2                                                                                 
β”œβ”€ caseless@0.12.0                                                                                  
β”œβ”€ chalk@2.0.1                                                                                      
β”œβ”€ change-case@2.3.1                                                                                
β”œβ”€ cli-cursor@2.1.0                                                                                 
β”œβ”€ cli-width@2.1.0                                                                                  
β”œβ”€ clone@2.1.1                                                                                      
β”œβ”€ co@4.6.0                                                                                         
β”œβ”€ color-convert@1.9.0                                                                              
β”œβ”€ color-name@1.1.3                                                                                 
β”œβ”€ combined-stream@1.0.5                                                                            
β”œβ”€ commander@2.11.0                                                                                 
β”œβ”€ component-emitter@1.2.1                                                                          
β”œβ”€ component-type@1.2.1                                                                             
β”œβ”€ concat-map@0.0.1                                                                                 
β”œβ”€ constant-case@1.1.2                                                                              
β”œβ”€ content-disposition@0.5.2                                                                        
β”œβ”€ content-type@1.0.2                                                                               
β”œβ”€ cookie-signature@1.0.6                                                                           
β”œβ”€ cookie@0.3.1                                                                                     
β”œβ”€ cookiejar@2.1.1                                                                                  
β”œβ”€ core-js@2.4.1                                                                                    
β”œβ”€ core-util-is@1.0.2                                                                               
β”œβ”€ create-react-class@15.6.0                                                                        
β”œβ”€ cross-spawn@5.1.0                                                                                
β”œβ”€ cryptiles@2.0.5                                                                                  
β”œβ”€ crypto-token@1.0.1                                                                               
β”œβ”€ dashdash@1.14.1                                                                                  
β”œβ”€ debug@2.6.7                                                                                      
β”œβ”€ decache@4.1.0                                                                                    
β”œβ”€ deep-diff@0.3.4                                                                                  
β”œβ”€ delay-async@1.1.0                                                                                
β”œβ”€ delayed-stream@1.0.0                                                                             
β”œβ”€ depd@1.1.1                                                                                       
β”œβ”€ destroy@1.0.4                                                                                    
β”œβ”€ dot-case@1.1.2                                                                                   
β”œβ”€ ecc-jsbn@0.1.1                                                                                   
β”œβ”€ ecdsa-sig-formatter@1.0.9                                                                        
β”œβ”€ ee-first@1.1.1                                                                                   
β”œβ”€ encodeurl@1.0.1                                                                                  
β”œβ”€ encoding@0.1.12                                                                                  
β”œβ”€ es6-error@4.0.2                                                                                  
β”œβ”€ escape-html@1.0.3                                                                                
β”œβ”€ escape-string-regexp@1.0.5                                                                       
β”œβ”€ etag@1.8.0                                                                                       
β”œβ”€ exec-async@2.2.0                                                                                 
β”œβ”€ exists-async@2.0.0                                                                               
β”œβ”€ express@4.15.3                                                                                   
β”œβ”€ extend@3.0.1                                                                                     
β”œβ”€ external-editor@2.0.4                                                                            
β”œβ”€ extsprintf@1.0.2                                                                                 
β”œβ”€ fbjs@0.8.14                                                                                      
β”œβ”€ figures@2.0.0                                                                                    
β”œβ”€ file-type@4.4.0                                                                                  
β”œβ”€ finalhandler@1.0.3                                                                               
β”œβ”€ forever-agent@0.6.1                                                                              
β”œβ”€ form-data@2.1.4                                                                                  
β”œβ”€ formidable@1.1.1                                                                                 
β”œβ”€ forwarded@0.1.0                                                                                  
β”œβ”€ freeport-async@1.1.1                                                                             
β”œβ”€ fresh@0.5.0                                                                                      
β”œβ”€ fs-extra@3.0.1                                                                                   
β”œβ”€ fs.realpath@1.0.0                                                                                
β”œβ”€ fstream@1.0.11                                                                                   
β”œβ”€ getpass@0.1.7                                                                                    
β”œβ”€ glob@7.1.2                                                                                       
β”œβ”€ graceful-fs@4.1.11                                                                               
β”œβ”€ har-schema@1.0.5                                                                                 
β”œβ”€ har-validator@4.2.1                                                                              
β”œβ”€ has-color@0.1.7                                                                                  
β”œβ”€ has-flag@2.0.0                                                                                   
β”œβ”€ hasbin@1.2.3                                                                                     
β”œβ”€ hawk@3.1.3                                                                                       
β”œβ”€ hoek@2.16.3                                                                                      
β”œβ”€ hoist-non-react-statics@1.2.0                                                                    
β”œβ”€ home-dir@1.0.0                                                                                   
β”œβ”€ http-errors@1.6.1                                                                                
β”œβ”€ http-signature@1.1.1                                                                             
β”œβ”€ iconv-lite@0.4.15                                                                                
β”œβ”€ indent-string@3.2.0                                                                              
β”œβ”€ inflight@1.0.6                                                                                   
β”œβ”€ inherits@2.0.3                                                                                   
β”œβ”€ inquirer@3.2.1                                                                                   
β”œβ”€ instapromise@2.0.7-rc.1                                                                          
β”œβ”€ invariant@2.2.2                                                                                  
β”œβ”€ ip@1.1.5                                                                                         
β”œβ”€ ipaddr.js@1.4.0                                                                                  
β”œβ”€ is-fullwidth-code-point@2.0.0                                                                    
β”œβ”€ is-lower-case@1.1.3                                                                              
β”œβ”€ is-promise@2.1.0                                                                                 
β”œβ”€ is-stream@1.1.0                                                                                  
β”œβ”€ is-typedarray@1.0.0                                                                              
β”œβ”€ is-upper-case@1.1.2                                                                              
β”œβ”€ isarray@1.0.0                                                                                    
β”œβ”€ isemail@2.2.1                                                                                    
β”œβ”€ isexe@2.0.0                                                                                      
β”œβ”€ isomorphic-fetch@2.2.1                                                                           
β”œβ”€ isstream@0.1.2                                                                                   
β”œβ”€ items@2.1.1                                                                                      
β”œβ”€ joi@10.6.0                                                                                       
β”œβ”€ join-component@1.1.0                                                                             
β”œβ”€ js-tokens@3.0.2                                                                                  
β”œβ”€ jsbn@0.1.1                                                                                       
β”œβ”€ jschardet@1.5.0                                                                                  
β”œβ”€ json-fallback@0.0.1                                                                              
β”œβ”€ json-schema@0.2.3                                                                                
β”œβ”€ json-stable-stringify@1.0.1                                                                      
β”œβ”€ json-stringify-safe@5.0.1                                                                        
β”œβ”€ json5@0.5.1                                                                                      
β”œβ”€ jsonfile@2.4.0                                                                                   
β”œβ”€ jsonify@0.0.0                                                                                    
β”œβ”€ jsonp@0.0.4                                                                                      
β”œβ”€ jsonschema@1.1.1                                                                                 
β”œβ”€ jsonwebtoken@7.4.1                                                                               
β”œβ”€ jsprim@1.4.0                                                                                     
β”œβ”€ jwa@1.1.5                                                                                        
β”œβ”€ jws@3.1.4                                                                                        
β”œβ”€ klaw@1.3.1                                                                                       
β”œβ”€ lodash-es@4.17.4                                                                                 
β”œβ”€ lodash.once@4.1.1                                                                                
β”œβ”€ lodash@4.17.4                                                                                    
β”œβ”€ loose-envify@1.3.1                                                                               
β”œβ”€ lower-case-first@1.0.2                                                                           
β”œβ”€ lower-case@1.1.4                                                                                 
β”œβ”€ lru-cache@4.1.1                                                                                  
β”œβ”€ match-require@2.1.0                                                                              
β”œβ”€ md5hex@1.0.0                                                                                     
β”œβ”€ media-typer@0.3.0                                                                                
β”œβ”€ merge-descriptors@1.0.1                                                                          
β”œβ”€ methods@1.1.2                                                                                    
β”œβ”€ mime-db@1.29.0                                                                                   
β”œβ”€ mime-types@2.1.16                                                                                
β”œβ”€ mime@1.3.4                                                                                       
β”œβ”€ mimic-fn@1.1.0                                                                                   
β”œβ”€ minimatch@3.0.4                                                                                  
β”œβ”€ minimist@1.2.0                                                                                   
β”œβ”€ mkdirp-promise@5.0.1                                                                             
β”œβ”€ mkdirp@0.5.1                                                                                     
β”œβ”€ moment@2.18.1                                                                                    
β”œβ”€ mout@0.11.1                                                                                      
β”œβ”€ ms@2.0.0                                                                                         
β”œβ”€ mute-stream@0.0.7                                                                                
β”œβ”€ mv@2.1.1                                                                                         
β”œβ”€ mz@2.6.0                                                                                         
β”œβ”€ ncp@2.0.0                                                                                        
β”œβ”€ negotiator@0.6.1                                                                                 
β”œβ”€ node-fetch@1.7.1                                                                                 
β”œβ”€ oauth-sign@0.8.2                                                                                 
β”œβ”€ object-assign@4.1.1                                                                              
β”œβ”€ object-keys@0.4.0                                                                                
β”œβ”€ on-finished@2.3.0                                                                                
β”œβ”€ once@1.4.0                                                                                       
β”œβ”€ onetime@2.0.1                                                                                    
β”œβ”€ opn@4.0.2                                                                                        
β”œβ”€ os-tmpdir@1.0.2                                                                                  
β”œβ”€ param-case@1.1.2                                                                                 
β”œβ”€ parseurl@1.3.1                                                                                   
β”œβ”€ pascal-case@1.1.2                                                                                
β”œβ”€ path-case@1.1.2                                                                                  
β”œβ”€ path-exists@3.0.0                                                                                
β”œβ”€ path-is-absolute@1.0.1                                                                           
β”œβ”€ path-to-regexp@0.1.7                                                                             
β”œβ”€ performance-now@0.2.0                                                                            
β”œβ”€ pify@3.0.0                                                                                       
β”œβ”€ pinkie-promise@2.0.1                                                                             
β”œβ”€ pinkie@2.0.4                                                                                     
β”œβ”€ process-nextick-args@1.0.7                                                                       
β”œβ”€ progress@2.0.0                                                                                   
β”œβ”€ promise-props@1.0.0                                                                              
β”œβ”€ promise@7.3.1                                                                                    
β”œβ”€ prop-types@15.5.10                                                                               
β”œβ”€ proxy-addr@1.1.5                                                                                 
β”œβ”€ pseudomap@1.0.2                                                                                  
β”œβ”€ punycode@1.3.2                                                                                   
β”œβ”€ qrcode-terminal@0.11.0                                                                           
β”œβ”€ qs@6.4.0                                                                                         
β”œβ”€ querystring@0.2.0                                                                                
β”œβ”€ range-parser@1.2.0                                                                               
β”œβ”€ raw-body@2.2.0                                                                                   
β”œβ”€ react-native-scripts@1.1.0                                                                       
β”œβ”€ react-redux@5.0.5                                                                                
β”œβ”€ read-chunk@2.1.0                                                                                 
β”œβ”€ readable-stream@2.3.3                                                                            
β”œβ”€ redux-logger@2.10.2                                                                              
β”œβ”€ redux@3.7.2                                                                                      
β”œβ”€ regenerator-runtime@0.10.5                                                                       
β”œβ”€ remove-trailing-slash@0.1.0                                                                      
β”œβ”€ request-progress@3.0.0                                                                           
β”œβ”€ request@2.81.0                                                                                   
β”œβ”€ reqwest@2.0.5                                                                                    
β”œβ”€ rest-facade@1.5.0                                                                                
β”œβ”€ restore-cursor@2.0.0                                                                             
β”œβ”€ rimraf@2.6.1                                                                                     
β”œβ”€ run-async@2.3.0                                                                                  
β”œβ”€ rx-lite-aggregates@4.0.8                                                                         
β”œβ”€ rx-lite@4.0.8                                                                                    
β”œβ”€ safe-buffer@5.1.1                                                                                
β”œβ”€ safe-json-stringify@1.0.4                                                                        
β”œβ”€ semver@5.4.1                                                                                     
β”œβ”€ send@0.15.3                                                                                      
β”œβ”€ sentence-case@1.1.3                                                                              
β”œβ”€ serve-static@1.12.3                                                                              
β”œβ”€ setimmediate@1.0.5                                                                               
β”œβ”€ setprototypeof@1.0.3                                                                             
β”œβ”€ shebang-command@1.2.0                                                                            
β”œβ”€ shebang-regex@1.0.0                                                                              
β”œβ”€ signal-exit@3.0.2                                                                                
β”œβ”€ slugid@1.1.0                                                                                     
β”œβ”€ slugify@1.1.0                                                                                    
β”œβ”€ snake-case@1.1.2                                                                                 
β”œβ”€ sntp@1.0.9                                                                                       
β”œβ”€ source-map-support@0.4.15                                                                        
β”œβ”€ source-map@0.5.6                                                                                 
β”œβ”€ sshpk@1.13.1                                                                                     
β”œβ”€ statuses@1.3.1                                                                                   
β”œβ”€ string_decoder@1.0.3                                                                             
β”œβ”€ string-width@2.1.1                                                                               
β”œβ”€ stringstream@0.0.5                                                                               
β”œβ”€ strip-ansi@4.0.0                                                                                 
β”œβ”€ superagent-retry@0.6.0                                                                           
β”œβ”€ superagent@3.5.2                                                                                 
β”œβ”€ supports-color@4.2.1                                                                             
β”œβ”€ swap-case@1.1.2                                                                                  
β”œβ”€ symbol-observable@1.0.4                                                                          
β”œβ”€ tar.gz@1.0.5                                                                                     
β”œβ”€ tar@2.2.1                                                                                        
β”œβ”€ thenify-all@1.6.0                                                                                
β”œβ”€ thenify@3.3.0                                                                                    
β”œβ”€ throttleit@1.0.0                                                                                 
β”œβ”€ through@2.3.8                                                                                    
β”œβ”€ title-case@1.1.2                                                                                 
β”œβ”€ tmp@0.0.31                                                                                       
β”œβ”€ topo@2.0.2                                                                                       
β”œβ”€ tough-cookie@2.3.2                                                                               
β”œβ”€ tree-kill@1.1.0                                                                                  
β”œβ”€ trim@0.0.1                                                                                       
β”œβ”€ tunnel-agent@0.6.0                                                                               
β”œβ”€ tweetnacl@0.14.5                                                                                 
β”œβ”€ type-is@1.6.15                                                                                   
β”œβ”€ ua-parser-js@0.7.14                                                                              
β”œβ”€ universalify@0.1.1                                                                               
β”œβ”€ unpipe@1.0.0                                                                                     
β”œβ”€ upper-case-first@1.1.2                                                                           
β”œβ”€ upper-case@1.1.3                                                                                 
β”œβ”€ url@0.11.0                                                                                       
β”œβ”€ util-deprecate@1.0.2                                                                             
β”œβ”€ utils-merge@1.0.0                                                                                
β”œβ”€ uuid@3.1.0                                                                                       
β”œβ”€ vary@1.1.1                                                                                       
β”œβ”€ verror@1.3.6                                                                                     
β”œβ”€ whatwg-fetch@2.0.3                                                                               
β”œβ”€ which@1.3.0                                                                                      
β”œβ”€ winchan@0.1.4                                                                                    
β”œβ”€ workspace-aggregator-d5775bd2-6a4e-47ad-8069-d4b04fbcc2f1@0.0.0                                  
β”œβ”€ wrappy@1.0.2                                                                                     
β”œβ”€ xdl@43.0.0                                                                                       
β”œβ”€ xhr2@0.1.4                                                                                       
β”œβ”€ xtend@4.0.1                                                                                      
β”œβ”€ yallist@2.1.2                                                                                    
└─ yesno@0.0.1                                                                                      
Done in 12.96s.                                                                                     
(node:42384) UnhandledPromiseRejectionWarning: Unhandled promise rejection (rejection id: 1): Error:
 ENOENT: no such file or directory, open 'C:\robdonn\Personal\robdonn\test\apps\native\node_modules\
react-native-scripts\package.json'                                                                  
(node:42384) [DEP0018] DeprecationWarning: Unhandled promise rejections are deprecated. In the futur
e, promise rejections that are not handled will terminate the Node.js process with a non-zero exit c
ode.                                                                                                

Environment

Please run these commands in the project folder and fill in their results:

  • npm ls react-native-scripts:
native@0.1.0 C:\robdonn\Personal\robdonn\test\apps\native
`-- (empty)
  • npm ls react-native:
native@0.1.0 C:\robdonn\Personal\robdonn\test\apps\native
`-- (empty)
  • npm ls expo:
native@0.1.0 C:\robdonn\Personal\robdonn\test\apps\native
`-- (empty)
  • node -v: v8.2.1
  • npm -v: 5.3.0
  • yarn --version: 0.27.5
  • watchman version: Please specify a target and action

Reproducible Demo

repro

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Reactions:7
  • Comments:8 (1 by maintainers)

github_iconTop GitHub Comments

11reactions
robdonncommented, May 12, 2018

Hey everyone, I figure since I opened this issue then I should resolve it.

The trick is a recent feature of yarn workspaces, nohoist. The nohoist option allows you to specify packages/directories that you do not want to be hoisted.

root package.json

{
  "name": "your-monorepo",
  "version": "1.0.0",
  "private": true,
  "workspaces": {
    "packages": [
      "your-crna-app"
    ],
    "nohoist": [
      "**/react-native/**",
      "**/react-native",
      "**/react-native-scripts",
      "**/react-native-scripts/**",
      "**/expo",
      "**/expo/**"
    ]
  }
}

I hope this helps anyone out there. More info

2reactions
scottmascommented, Jan 24, 2018

@brentvatne This still isn’t working. It would be real nice if it could be resolved. I think all that needs to change is how Exp looks for react native.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Workspaces
Finally, run yarn install somewhere, ideally inside the workspace root. ... It won't be there unless some other package use it as a...
Read more >
yarn not installing packages from workspace but instead ...
In your app's package.json , try these. "tsconfig": "*", "eslint-config-custom": "*",. In pnpm , packages are installed by workspaces:*Β ...
Read more >
npm, pnpm, and Yarn | IntelliJ IDEA Documentation
IntelliJ IDEA integrates with the npm, Yarn, Yarn 2, and pnpm, so you can install, locate, update, and remove packages of reusable code...
Read more >
Advanced package manager features for npm, Yarn, and ...
npm workspaces; Yarn Berry workspaces; pnpm workspaces ... If you add, update, or remove dependencies, you have to run yarn install ...
Read more >
A guide through The Wild Wild West of setting up a mono repo ...
We will be using TypeScript, Yarn workspaces, Lerna, and Jest. ... so running yarn install from within a package may break the meta...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found