[BUG] Workspaces: 'Prepare: build' leads to error on npm install in base directory #3972
Open
1 task done
Labels
Bug
thing that needs fixing
Needs Triage
needs review for next steps
Release 8.x
work is associated with a specific npm 8 release
Is there an existing issue for this?
Current Behavior
base-dir
packages/
package1/
package.json -> dependency: package2
package2/
...
package.json
workdir: ["packages/*"]
I have prepare scripts in each package which should build the package-project. On npm install in base directory npm install of each package will be run and therefore also the prepare scripts. At this point it seems though that the dependencies are not resolved correctly leading to an error on npm install and therefore dismissing further installations. The missing dependencies are locally installed in the node_modules directory of the packages. Therefore this should not lead to an error.
Npm install, npm run build, npm run prepare work fine from the package´s directory.
Might it be that the npm run prepare build is not run with cwd: package? Or how does npm install resolve the dependencies and dependency versions of each package. For some packages it seems that different versions of dependend packages are available but not the local installed dependency of the package.
This might be correlated with a few other bug reports.
Example error message
SonarQubePredecessorsQuantifier/cache/cache.ts: Cannot find module: This module is locally installed in the package´s node_modules directory. Npm install, npm build works fine with cwd: package.
npm ERR! code 2 npm ERR! path C:\ma-implementation-3\implementation\packages\bugFinder-commitPath-quantifier-sonarqubePredecessors npm ERR! command failed npm ERR! command C:\Windows\system32\cmd.exe /d /s /c npm run build npm ERR! > [email protected] build npm ERR! > npm run clean && tsc --project . npm ERR! npm ERR! npm ERR! > [email protected] clean npm ERR! > rimraf ./dist npm ERR! npm ERR! src/sonarQubePredecessorsQuantifier/cache/cache.ts(3,36): error TS2307: Cannot find module 'bugfinder-commitpath-quantifier-sonarqube' or its corresponding type declarations. npm ERR! src/sonarQubePredecessorsQuantifier/measurement/Elements.ts(1,23): error TS2307: Cannot find module 'bugfinder-commitpath-quantifier-sonarqube' or its corresponding type declarations. npm ERR! src/sonarQubePredecessorsQuantifier/measurement/SonarQubePredecessorMeasurement.ts(1,55): error TS2307: Cannot find module 'bugfinder-commitpath-quantifier-sonarqube' or its corresponding type declarations. npm ERR! src/sonarQubePredecessorsQuantifier/measurement/Visitors.ts(1,23): error TS2307: Cannot find module 'bugfinder-commitpath-quantifier-sonarqube' or its corresponding type declarations. npm ERR! src/sonarQubePredecessorsQuantifier/sonarQubePredecessorsQuantifier.ts(10,57): error TS2307: Cannot find module 'bugfinder-commitpath-quantifier-sonarqube' or its corresponding type declarations.
Expected Behavior
Npm install works fine.
Npm install of each package installs with cwd: package and the dependencies of the package`s package.json are locally used.
No response
Environment
The text was updated successfully, but these errors were encountered: