npm Community Forum (Archive)

The npm community forum has been discontinued.

To discuss usage of npm, visit the GitHub Support Community.

Error npm install circular dependencies

When upgrading npm from 4.3.0 to any version >= 5.0.0, npm install in a subpackage doesn’t work anymore for our use case.

Our directory structure:

|-- packages
    |-- @core
        |-- sequences
        |-- router
        |-- ...
    |-- template
|-- package.json
|-- node_modules

template -> router -> sequences -> router -> sequences… amongst other cyclic dependencies

Packages dependencies are symlinked to the root node_modules or to the local folder.

Our problem is that we can’t run npm install in template, it seems to loop forever

Trimmed output of npm install --production (usually ending with maximum callstack size exceeded):

WARN tar ENOENT: no such file or directory, open 'packages/template/node_modules/.staging/ramda-3abc7d57/src/mergeAll.js'
WARN tar ENOENT: no such file or directory, open 'packages/template/node_modules/.staging/ramda-3abc7d57/src/mapAccumRight.js'
WARN tar ENOENT: no such file or directory, open 'packages/template/node_modules/.staging/ramda-3abc7d57/src/mergeDeepLeft.js'
WARN tar ENOENT: no such file or directory, lstat 'packages/template/node_modules/.staging/core-js-1b96c5b5/fn/string'
WARN tar ENOENT: no such file or directory, lstat 'packages/template/node_modules/.staging/core-js-1b96c5b5/fn/string'
WARN tar ENOENT: no such file or directory, lstat 'packages/template/node_modules/.staging/fbjs-5779dd68/lib/__mocks__'
... more
npm WARN react-redux@5.0.7 requires a peer of react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN react-redux@5.0.7 requires a peer of redux@^2.0.0 || ^3.0.0 || ^4.0.0-0 but none is installed. You must install peer dependencies yourself.
npm WARN react-router@1.0.3 requires a peer of history@^1.17.0 but none is installed. You must install peer dependencies yourself.
npm WARN recompose@0.20.2 requires a peer of react@^0.14.0 || ^15.0.0 but none is installed. You must install peer dependencies yourself.
... more
npm ERR! path /Users/sebastien/Fastory-Workspace/fastory/packages/template/node_modules/.staging/asap-89fb7578
npm ERR! code EEXIST
npm ERR! errno -17
npm ERR! syscall mkdir
npm ERR! EEXIST: file already exists, mkdir '/Users/sebastien/Fastory-Workspace/fastory/packages/template/node_modules/.staging/asap-89fb7578'
npm ERR! File exists: /Users/sebastien/Fastory-Workspace/fastory/packages/template/node_modules/.staging/asap-89fb7578
npm ERR! Move it away, and try again.

Trimmed output of npm ls --production:

 @core/sequences@1.0.0 packages/@core/sequences
├─┬ @core/addons@1.0.0 -> packages/@core/addons
│ ├── UNMET PEER DEPENDENCY react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
│ ├─┬ react-redux@5.0.7
│ │ ├── UNMET DEPENDENCY invariant@^2.0.0
│ │ ├── UNMET DEPENDENCY lodash-es@^4.17.5
│ │ ├── UNMET DEPENDENCY loose-envify@^1.1.0
│ └── UNMET PEER DEPENDENCY redux@^2.0.0 || ^3.0.0 || ^4.0.0-0
├─┬ @core/fromJSON@1.0.0 -> packages/@core/fromJSON
│ ├─┬ @core/router@1.0.0
│ ├─┬ @core/sequences@1.0.0
│ │ ├── UNMET PEER DEPENDENCY react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
├─┬ @core/router@1.0.0 -> packages/@core/router
│ ├─┬ @core/sequences@1.0.0
│ │ ├── @core/addons@1.0.0 -> packages/@core/addons deduped
│ │ ├── UNMET PEER DEPENDENCY react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0
├─┬ react-redux@5.0.7 -> node_modules/react-redux
│ ├── UNMET DEPENDENCY invariant@^2.0.0
│ ├── UNMET DEPENDENCY lodash-es@^4.17.5
│ ├── UNMET DEPENDENCY loose-envify@^1.1.0
│   ├── UNMET DEPENDENCY loose-envify@^1.3.1
│   └── UNMET DEPENDENCY object-assign@^4.1.1
└─┬ redux@3.6.0 -> node_modules/redux
  ├── UNMET DEPENDENCY lodash-es@^4.2.1
  ├── UNMET DEPENDENCY loose-envify@^1.1.0
  └── UNMET DEPENDENCY symbol-observable@^1.0.2

npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0, required by react-redux@5.0.7
npm ERR! peer dep missing: redux@^2.0.0 || ^3.0.0 || ^4.0.0-0, required by react-redux@5.0.7
npm ERR! extraneous: invariant@2.2.4 packages/@core/sequences/node_modules/@core/addons/node_modules/invariant
npm ERR! extraneous: lodash@4.17.10 packages/@core/sequences/node_modules/@core/addons/node_modules/lodash
npm ERR! extraneous: lodash-es@4.17.10 packages/@core/sequences/node_modules/@core/addons/node_modules/lodash-es
npm ERR! extraneous: prop-types@15.6.2 packages/@core/sequences/node_modules/@core/addons/node_modules/prop-types
npm ERR! missing: invariant@^2.0.0, required by react-redux@5.0.7
npm ERR! missing: lodash-es@^4.17.5, required by react-redux@5.0.7
npm ERR! missing: loose-envify@^1.1.0, required by react-redux@5.0.7
npm ERR! missing: combined-stream@^1.0.5, required by form-data@1.0.1
npm ERR! missing: mime-types@^2.1.11, required by form-data@1.0.1
npm ERR! extraneous: tape@4.6.0packages/@core/sequences/node_modules/@core/array/node_modules/tape
npm ERR! extraneous: deep-equal@1.0.1 packages/@core/sequences/node_modules/@core/router/node_modules/deep-equal
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0, required by react-redux@5.0.7
npm ERR! missing: lodash@>=3.0, required by cloudinary-core@2.1.6
npm ERR! extraneous: tape@4.6.0 packages/@core/sequences/node_modules/@core/object/node_modules/@core/math/node_modules/tape
npm ERR! extraneous: tape@4.6.0 packages/@core/sequences/node_modules/@core/object/node_modules/@core/string/node_modules/tape
npm ERR! extraneous: deep-equal@1.0.1 packages/@core/sequences/node_modules/@core/router/node_modules/deep-equal
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0, required by react-redux@5.0.7
npm ERR! missing: deep-equal@^1.0.1, required by redux-router@1.0.0
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0, required by react-redux@5.0.7
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0, required by recompose@0.20.2
npm ERR! peer dep missing: redux@^2.0.0 || ^3.0.0 || ^4.0.0-0, required by react-redux@5.0.7
npm ERR! peer dep missing: history@^1.17.0, required by react-router@1.0.3
npm ERR! extraneous: tape@4.6.0 packages/@core/sequences/node_modules/@core/object/node_modules/@core/string/node_modules/tape
npm ERR! missing: fbjs@^0.8.9, required by prop-types@15.5.10
npm ERR! missing: loose-envify@^1.3.1, required by prop-types@15.5.10
npm ERR! missing: invariant@^2.0.0, required by react-redux@5.0.7
npm ERR! missing: lodash-es@^4.17.5, required by react-redux@5.0.7
npm ERR! missing: loose-envify@^1.1.0, required by react-redux@5.0.7
npm ERR! missing: invariant@^2.0.0, required by react-router@1.0.3
npm ERR! missing: warning@^2.0.0, required by react-router@1.0.3
npm ERR! missing: change-emitter@^0.1.2, required by recompose@0.20.2
npm ERR! missing: fbjs@^0.8.1, required by recompose@0.20.2
npm ERR! missing: hoist-non-react-statics@^1.0.0, required by recompose@0.20.2
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0, required by react-redux@5.0.7
npm ERR! peer dep missing: redux@^2.0.0 || ^3.0.0 || ^4.0.0-0, required by react-redux@5.0.7
npm ERR! extraneous: hoist-non-react-statics@2.5.5 packages/@core/sequences/node_modules/@core/addons/node_modules/hoist-non-react-statics
npm ERR! extraneous: invariant@2.2.4 packages/@core/sequences/node_modules/@core/addons/node_modules/invariant
npm ERR! extraneous: lodash@4.17.10 packages/@core/sequences/node_modules/@core/addons/node_modules/lodash
npm ERR! extraneous: lodash-es@4.17.10 packages/@core/sequences/node_modules/@core/addons/node_modules/lodash-es
npm ERR! extraneous: prop-types@15.6.2 packages/@core/sequences/node_modules/@core/addons/node_modules/prop-types
npm ERR! peer dep missing: react@^0.14.0 || ^15.0.0-0 || ^16.0.0-0, required by react-redux@5.0.7
npm ERR! peer dep missing: redux@^2.0.0 || ^3.0.0 || ^4.0.0-0, required by react-redux@5.0.7
npm ERR! missing: invariant@^2.0.0, required by react-redux@5.0.7
npm ERR! missing: lodash-es@^4.17.5, required by react-redux@5.0.7
npm ERR! missing: loose-envify@^1.1.0, required by react-redux@5.0.7
npm ERR! missing: invariant@^2.0.0, required by react-redux@5.0.7
npm ERR! missing: lodash-es@^4.17.5, required by react-redux@5.0.7
npm ERR! missing: loose-envify@^1.1.0, required by react-redux@5.0.7
npm ERR! missing: loose-envify@^1.3.1, required by prop-types@15.6.2
npm ERR! missing: object-assign@^4.1.1, required by prop-types@15.6.2
npm ERR! missing: lodash-es@^4.2.1, required by redux@3.6.0
npm ERR! missing: loose-envify@^1.1.0, required by redux@3.6.0
npm ERR! missing: symbol-observable@^1.0.2, required by redux@3.6.0

Thanks for your help