Я не уверен, если это проблема с create-react-app
или yarn
.
Я пытаюсь использовать create-react-app
. Кажется, он использует yarn
для получения зависимостей, но yarn
игнорирует собственный параметр конфигурации реестра и пытается загрузить пакеты напрямую из https://registry.yarnpkg.com/.
Это вывод, когда я пытаюсь использовать create-react-app
. В конце вы можете увидеть, что yarn
игнорирует настройку реестра:
$ npx create-react-app@2.1.2 my-app --verbose --registry "http://myownregistry:1234/"
npm info it worked if it ends with ok
npm info using npm@6.4.1
npm info using node@v10.13.0
npm timing npm Completed in 153ms
npm info ok
npx: installed 63 in 72.714s
Creating a new React app in C:\work\my-app.
Installing packages. This might take a couple of minutes.
Installing react, react-dom, and react-scripts...
yarn add v1.13.0
verbose 0.399 Checking for configuration file "C:\\work\\my-app\\.npmrc".
verbose 0.4 Checking for configuration file "C:\\Users\\jbloggs\\.npmrc".
verbose 0.4 Found configuration file "C:\\Users\\jbloggs\\.npmrc".
verbose 0.401 Checking for configuration file "C:\\Program Files\\nodejs\\etc\\npmrc".
verbose 0.401 Checking for configuration file "C:\\work\\my-app\\.npmrc".
verbose 0.402 Checking for configuration file "C:\\work\\.npmrc".
verbose 0.406 Checking for configuration file "C:\\work\\my-app\\.yarnrc".
verbose 0.406 Checking for configuration file "C:\\Users\\jbloggs\\.yarnrc".
verbose 0.406 Found configuration file "C:\\Users\\jbloggs\\.yarnrc".
verbose 0.407 Checking for configuration file "C:\\Program Files\\nodejs\\etc\\yarnrc".
verbose 0.407 Checking for configuration file "C:\\work\\my-app\\.yarnrc".
verbose 0.407 Checking for configuration file "C:\\work\\.yarnrc".
verbose 0.417 current time: 2019-01-21T16:43:06.912Z
[1/4] Resolving packages...
verbose 0.637 Performing "GET" request to "http://myownregistry:1234/react".
verbose 2.827 Request "http://myownregistry:1234/react" finished with status code 200.
verbose 2.837 Performing "GET" request to "http://myownregistry:1234/loose-envify".
verbose 2.839 Performing "GET" request to "http://myownregistry:1234/scheduler".
[... lots of similar lines removed lines removed ...]
verbose 23.218 Request "http://myownregistry:1234/string_decoder" finished with status code 200.
[2/4] Fetching packages...
verbose 23.473 Performing "GET" request to "https://registry.yarnpkg.com/object-assign/-/object-assign-4.1.1.tgz".
verbose 23.483 Performing "GET" request to "https://registry.yarnpkg.com/prop-types/-/prop-types-15.6.2.tgz".
verbose 23.486 Performing "GET" request to "https://registry.yarnpkg.com/loose-envify/-/loose-envify-1.4.0.tgz".
verbose 23.492 Performing "GET" request to "https://registry.yarnpkg.com/js-tokens/-/js-tokens-4.0.0.tgz".
verbose 23.514 Performing "GET" request to "https://registry.yarnpkg.com/babel-core/-/babel-core-7.0.0-bridge.0.tgz".
verbose 23.518 Performing "GET" request to "https://registry.yarnpkg.com/@babel/core/-/core-7.1.6.tgz".
verbose 23.52 Performing "GET" request to "https://registry.yarnpkg.com/@svgr/webpack/-/webpack-2.4.1.tgz".
verbose 23.531 Performing "GET" request to "https://registry.yarnpkg.com/babel-eslint/-/babel-eslint-9.0.0.tgz".
Missing dependencies in package.json
Однако, если я использую Yarn сам по себе, он будет использовать значение конфигурации реестра.
$ yarn add object-assign@4.1.1 --verbose
yarn add v1.13.0
verbose 0.375 Checking for configuration file "C:\\work\\.npmrc".
verbose 0.376 Checking for configuration file "C:\\Users\\jbloggs\\.npmrc".
verbose 0.376 Found configuration file "C:\\Users\\jbloggs\\.npmrc".
verbose 0.378 Checking for configuration file "C:\\Program Files\\nodejs\\etc\\npmrc".
verbose 0.379 Checking for configuration file "C:\\work\\.npmrc".
verbose 0.383 Checking for configuration file "C:\\work\\.yarnrc".
verbose 0.383 Checking for configuration file "C:\\Users\\jbloggs\\.yarnrc".
verbose 0.383 Found configuration file "C:\\Users\\jbloggs\\.yarnrc".
verbose 0.384 Checking for configuration file "C:\\Program Files\\nodejs\\etc\\yarnrc".
verbose 0.384 Checking for configuration file "C:\\work\\.yarnrc".
verbose 0.39 current time: 2019-01-21T16:48:15.659Z
info No lockfile found.
[1/4] Resolving packages...
verbose 0.488 Performing "GET" request to "http://myownregistry:1234/object-assign".
verbose 3.892 Request "http://myownregistry:1234/object-assign" finished with status code 200.
[2/4] Fetching packages...
verbose 3.932 Performing "GET" request to "http://myownregistry:1234/object-assign/-/object-assign-4.1.1.tgz".
[3/4] Linking dependencies...
verbose 4.143 Creating directory "C:\\work\\node_modules\\object-assign".
verbose 4.146 Copying "C:\\Users\\jbloggs\\AppData\\Local\\Yarn\\Cache\\v4\\npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863\\node_modules\\object-assign\\index.js" to "C:\\work\\node_modules\\object-assign\\index.js".
verbose 4.147 Copying "C:\\Users\\jbloggs\\AppData\\Local\\Yarn\\Cache\\v4\\npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863\\node_modules\\object-assign\\license" to "C:\\work\\node_modules\\object-assign\\license".
verbose 4.147 Copying "C:\\Users\\jbloggs\\AppData\\Local\\Yarn\\Cache\\v4\\npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863\\node_modules\\object-assign\\package.json" to "C:\\work\\node_modules\\object-assign\\package.json".
verbose 4.147 Copying "C:\\Users\\jbloggs\\AppData\\Local\\Yarn\\Cache\\v4\\npm-object-assign-4.1.1-2109adc7965887cfc05cbbd442cac8bfbb360863\\node_modules\\object-assign\\readme.md" to "C:\\work\\node_modules\\object-assign\\readme.md".
[4/4] Building fresh packages...
success Saved lockfile.
success Saved 1 new dependency.
info Direct dependencies
+- object-assign@4.1.1
info All dependencies
+- object-assign@4.1.1
Done in 3.86s.
Что я могу сделать, чтобы create-react-app
вызвал yarn
таким образом, чтобы yarn
использовал значение конфигурации реестра?