强制在纱线之前运行npm安装?

时间:2020-08-06 00:30:11

标签: node.js reactjs npm npm-install yarnpkg

今天奇怪,想知道您是否能帮忙。

我最近重新格式化了工作笔记本电脑,然后重新安装了所有工具。奇怪的是,我发现必须在新的git克隆项目上运行npm installyarn(仅执行我们的故事书/启动过程)之前,必须完整运行yarn sb。 / p>

仅运行yarn(如您在下面看到的那样)会导致有关错误的错误:无法找到模块'./es6.array.iterator'

有什么想法可能会这样吗?看来npm install在做一些额外的编译步骤,而yarn不是,我了解到yarn可以完成npm install可以做的一切,但是效率更高。

/* TRIED YARN BY ITSELF - FAILED */
PS C:\dev\projects\react-components-ts> yarn   

yarn install v1.22.4
[1/5] Validating package.json...
[2/5] Resolving packages...
[3/5] Fetching packages...
info fsevents@1.2.13: The platform "win32" is incompatible with this module.
info "fsevents@1.2.13" is an optional dependency and failed compatibility check. Excluding it from installation.
info fsevents@2.1.3: The platform "win32" is incompatible with this module.
info "fsevents@2.1.3" is an optional dependency and failed compatibility check. Excluding it from installation.
[4/5] Linking dependencies...
warning " > material-table@1.66.0" has unmet peer dependency "@date-io/core@^1.3.6".
warning "material-table > @material-ui/pickers@3.2.10" has unmet peer dependency "@date-io/core@^1.3.6".
warning "@storybook/addon-actions > @storybook/api@5.3.19" has unmet peer dependency "regenerator-runtime@*".
warning "@storybook/addon-docs > @egoist/vue-to-react@1.1.0" has unmet peer dependency "vue@^2.6.10".
warning "@storybook/addon-docs > vue-docgen-loader@1.5.0" has unmet peer dependency "webpack@>=4".
warning " > @storybook/addon-storysource@5.3.19" has unmet peer dependency "@storybook/source-loader@*".
warning " > babel-loader@8.1.0" has unmet peer dependency "webpack@>=2".
[5/5] Building fresh packages...
$ tsdx build
Error: Cannot find module './es6.array.iterator'
Require stack:
- C:\dev\projects\react-components-ts\node_modules\babel-runtime\node_modules\core-js\library\modules\web.dom.iterable.js
- C:\dev\projects\react-components-ts\node_modules\babel-runtime\node_modules\core-js\library\fn\get-iterator.js
- C:\dev\projects\react-components-ts\node_modules\babel-traverse\lib\index.js
- C:\dev\projects\react-components-ts\node_modules\tsdx\dist\errors\extractErrors.js
- C:\dev\projects\react-components-ts\node_modules\tsdx\dist\createRollupConfig.js
- C:\dev\projects\react-components-ts\node_modules\tsdx\dist\createBuildConfigs.js
- C:\dev\projects\react-components-ts\node_modules\tsdx\dist\index.js
    at Function.Module._resolveFilename (internal/modules/cjs/loader.js:957:15)
    at Function.Module._load (internal/modules/cjs/loader.js:840:27)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
    at require (internal/modules/cjs/helpers.js:77:18)
    at Object.<anonymous> (C:\dev\projects\react-components-ts\node_modules\babel-runtime\node_modules\core-js\library\modules\web.dom.iterable.js:1:1)
    at Module._compile (internal/modules/cjs/loader.js:1133:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:1153:10)
    at Module.load (internal/modules/cjs/loader.js:977:32)
    at Function.Module._load (internal/modules/cjs/loader.js:877:14)
    at Module.require (internal/modules/cjs/loader.js:1019:19)
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/install for documentation about this command.


/* BUILT EXTRA STUFF */
PS C:\dev\projects\react-components-ts> npm i
npm WARN deprecated request@2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
npm WARN deprecated har-validator@5.1.5: this library is no longer supported
npm WARN deprecated os-homedir@2.0.0: This is not needed anymore. Use `require('os').homedir()` instead.
npm WARN deprecated left-pad@1.3.0: use String.prototype.padStart()
npm WARN deprecated popper.js@1.16.1: You can find the new Popper v2 at @popperjs/core, this package is dedicated to the legacy v1
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN deprecated urix@0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url@0.2.1: https://github.com/lydell/resolve-url#deprecated
npm WARN deprecated core-js@1.2.7: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated rollup-plugin-babel@4.4.0: This package has been deprecated and is no longer maintained. Please use @rollup/plugin-babel.
npm WARN deprecated core-js@2.6.11: core-js@<3 is no longer maintained and not recommended for usage due to the number of issues. Please, upgrade your dependencies to the actual version of core-js@3.
npm WARN deprecated request-promise-native@1.0.9: request-promise-native has been deprecated because it extends the now deprecated request package, see https://github.com/request/request/issues/3142

> husky@4.2.5 preuninstall C:\dev\projects\react-components-ts\node_modules\husky
> node husky uninstall

husky > Uninstalling git hooks
husky > Done
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\jest.cmd as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\jest
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\jest as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\jest
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\rimraf.cmd as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\rimraf
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\rimraf as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\rimraf
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\semver.cmd as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\semver
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\semver as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\semver
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\detect.cmd as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\detect-port
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\detect-port.cmd as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\detect-port
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\detect as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\detect-port
npm WARN rm not removing C:\dev\projects\react-components-ts\node_modules\.bin\detect-port as it wasn't installed by C:\dev\projects\react-components-ts\node_modules\detect-port

> husky@4.2.5 install C:\dev\projects\react-components-ts\node_modules\husky
> node husky install

husky > Setting up git hooks
husky > Done

> core-js@2.6.11 postinstall C:\dev\projects\react-components-ts\node_modules\@babel\polyfill\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 
Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> core-js@2.6.11 postinstall C:\dev\projects\react-components-ts\node_modules\babel-runtime\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js@3.6.5 postinstall C:\dev\projects\react-components-ts\node_modules\core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall C:\dev\projects\react-components-ts\node_modules\core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall C:\dev\projects\react-components-ts\node_modules\ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)


> husky@4.2.5 postinstall C:\dev\projects\react-components-ts\node_modules\husky
> opencollective-postinstall || exit 0

Thank you for using husky!
If you rely on this package, please consider supporting our open collective:
> https://opencollective.com/husky/donate


> jsonpath@1.0.2 postinstall C:\dev\projects\react-components-ts\node_modules\jsonpath
> node lib/aesprim.js > generated/aesprim-browser.js


> @dhi/react-components-ts@0.2.6 prepare C:\dev\projects\react-components-ts
> tsdx build

✓ Creating entry file 18.7 secs
✓ Building modules 1.1 mins
npm notice created a lockfile as package-lock.json. You should commit this file.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules\jest-haste-map\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN notsup Unsupported engine for watchpack-chokidar2@2.0.0: wanted: {"node":"<8.10.0"} (current: {"node":"12.16.3","npm":"6.14.4"})
npm WARN notsup Not compatible with your version of node/npm: watchpack-chokidar2@2.0.0
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@~2.1.2 (node_modules\chokidar\node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})
npm WARN acorn-dynamic-import@4.0.0 requires a peer of acorn@^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @egoist/vue-to-react@1.1.0 requires a peer of vue@^2.6.10 but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of @typescript-eslint/eslint-plugin@2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of @typescript-eslint/parser@2.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-config-react-app@5.2.1 requires a peer of eslint@6.x but none is installed. You must install peer dependencies yourself.
npm WARN eslint-plugin-react-hooks@2.5.1 requires a peer of eslint@^3.0.0 || ^4.0.0 || ^5.0.0 || ^6.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN @dhi/react-components-ts@0.2.6 No repository field.

added 291 packages from 79 contributors, removed 188 packages, updated 2114 packages and audited 2414 packages in 334.47s

162 packages are looking for funding
    run `npm fund` for details

found 2 vulnerabilities (1 low, 1 moderate)
    run `npm audit fix` to fix them, or `npm audit` for details

/* NOW YARN RUNS FINE - WITH OBVIOUS package-lock WARNING */
PS C:\dev\projects\react-components-ts> yarn
yarn install v1.22.4
warning package-lock.json found. Your project contains lock files generated by tools other than Yarn. It is advised not to mix package managers in order to avoid resolution inconsistencies caused by unsynchronized lock files. To clear this warning, remove package-lock.json.
[1/5] Validating package.json...
[2/5] Resolving packages...
success Already up-to-date.
$ tsdx build
✓ Creating entry file 7.3 secs
✓ Building modules 12.2 secs
Done in 21.32s.

/* AND WE CAN RUN OUR PROJECT */
PS C:\dev\projects\react-components-ts> yarn sb 
yarn run v1.22.4
$ start-storybook -p 6006
info @storybook/react v5.3.19
info
info => Loading presets
info => Loading presets
info => Loading config/preview file in "./.storybook".
info => Adding stories defined in ".storybook\main.js".
info => Using default Webpack setup.
info => Using base config because react-scripts is not installed.
webpack built 19b2af886909fb20a73e in 53119ms
╭────────────────────────────────────────────────────╮
│                                                    │
│   Storybook 5.3.19 started                         │
│   26 s for manager and 55 s for preview            │
│                                                    │
│    Local:            http://localhost:6006/        │
│    On your network:  http://172.16.125.17:6006/    │
│                                                    │
╰────────────────────────────────────────────────────╯
No issues found.

0 个答案:

没有答案