Suddenly npm doesn't install all dependencies for me anymore. Some are there like eslint while others like lerna are missing. The npm i command succeeds, but various packages are missing in node_modules.
I tried pretty much everything, deleting all node_modules folders (of all monorepo workspaces), deleting ~/.npm, updating npm & reverting my local changes to the affected project.
We're using nix to manage the native dependencies of this project so our devs (me + one other person) have the same nodejs & npm versions installed.
At the moment this issue only occurs on my machine. My colleague gave me a copy of their node_modules folder and I can run lerna from that, but every time I run npm i again I get the same issue.
One of the missing dependencies is lerna. When I run npm ls lerna, I get:
Alright, I recently set NODE_ENV=production in an env file for testing purposes and forgot about it.
I didn't know that this setting also effects npm install so that it doesn't install devDependencies.
Is there an existing issue for this?
Current Behavior
Suddenly npm doesn't install all dependencies for me anymore. Some are there like
eslint
while others likelerna
are missing. Thenpm i
command succeeds, but various packages are missing innode_modules
. I tried pretty much everything, deleting allnode_modules
folders (of all monorepo workspaces), deleting~/.npm
, updating npm & reverting my local changes to the affected project. We're using nix to manage the native dependencies of this project so our devs (me + one other person) have the same nodejs & npm versions installed. At the moment this issue only occurs on my machine. My colleague gave me a copy of theirnode_modules
folder and I can runlerna
from that, but every time I runnpm i
again I get the same issue.One of the missing dependencies is
lerna
. When I runnpm ls lerna
, I get:And here's the root
package.json
of the monorepo:package.json
```json { "$schema": "https://json.schemastore.org/package", "name": "@project/project", "version": "1.0.0", "private": true, "description": "", "workspaces": [ "clients/preregistration", "clients/web", "common/api/typescript/*", "components/*", "data/*", "lib/*", "tools/*", "utils/*" ], "scripts": { "build": "npm run lerna-run-app -- --parallel build", "build:web": "npm run lerna-run-app-web -- build", "deploy": "lerna run deploy", "lerna-prepare": "scripts/lerna-run-ordered 'lerna run prepare --scope {package}'", "lerna-run-app": "lerna run --scope \"@project/app-*\"", "lerna-run-app-web": "lerna run --scope \"@project/app-web\"", "lerna-run-not-app": "lerna run --ignore \"@project/app-*\"", "prepare": "npm run tsc-references:update && npm run lerna-prepare", "start": "npm run lerna-run-app -- --parallel start", "start:web": "npm run lerna-run-app-web -- start", "syncpack": "./scripts/syncpack", "test": "lerna run test", "tsc-references:update": "workspaces-to-typescript-project-references && prettier --write **/tsconfig.json", "watch": "lerna run --parallel --ignore \"@project/app-*\" watch" }, "devDependencies": { "@appigram/react-rangeslider": "2.2.9", "@monorepo-utils/workspaces-to-typescript-project-references": "^2.4.3", "@types/estree": "^0.0.46", "@types/reactstrap": "^8.7.2", "@typescript-eslint/eslint-plugin": "^4.25.0", "@typescript-eslint/parser": "^4.25.0", "ajv-cli": "^3.3.0", "babel-eslint": "^10.1.0", "colors": "^1.4.0", "concurrently": "^5.1.0", "eslint": "^7.25.0", "eslint_d": "^10.1.0", "eslint-config-prettier": "^6.15.0", "eslint-plugin-html": "^6.1.1", "eslint-plugin-import": "^2.22.1", "eslint-plugin-jsx-a11y": "^6.4.1", "eslint-plugin-prettier": "^3.1.4", "eslint-plugin-react": "^7.21.5", "eslint-plugin-react-hooks": "^4.2.0", "eslint-plugin-simple-import-sort": "^6.0.1", "husky": "^4.2.3", "jest": "^26.6.3", "jest-runner": "^26.6.3", "jest-runtime": "^26.6.3", "lerna": "^3.20.2", "lint-gitlab-ci": "^1.1.1", "lint-staged": "^10.0.9", "prettier": "^2.2.0", "prettier-plugin-packagejson": "^2.2.8", "react": "^16.14.0", "react-dom": "^16.13.1", "react-media": "^1.10.0", "react-redux": "^7.2.0", "stylelint": "^13.8.0", "stylelint-config-prettier": "^8.0.2", "stylelint-config-recommended": "^3.0.0", "stylelint-prettier": "^1.1.2", "syncpack": "^5.0.1", "type-fest": "^0.13.1", "typescript": "^4.2.3", "typescript-styled-plugin": "^0.15.0" } } ```Expected Behavior
npm i
should install all dependencies and if it can't, it should throw an error.Steps To Reproduce
I haven't found a way to reproduce this issue yet, I'll update this if I do.
Environment