When building a nestjs project with NX in monorepo, it shoots an annoying error where it cant find an npm package. This has already been described in #15835 however this issue still occurs.
NX An error occured while creating pruned lockfile
Please open an issue at `https://github.com/nrwl/nx/issues/new?template=1-bug.yml` and provide a reproduction.
To prevent the build from breaking we are returning the root lock file.
Original error: Target project does not exist: npm:tmp@0.0.33
Error: Target project does not exist: npm:tmp@0.0.33
at validateCommonDependencyRules (/Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/project-graph/project-graph-builder.js:323:15)
at validateDependency (/Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/project-graph/project-graph-builder.js:313:5)
at ProjectGraphBuilder.addDependency (/Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/project-graph/project-graph-builder.js:190:9)
at ProjectGraphBuilder.addStaticDependency (/Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/project-graph/project-graph-builder.js:89:14)
at /Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:81:17
at Array.forEach (<anonymous>)
at traverseNode (/Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:78:36)
at /Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:80:9
at Array.forEach (<anonymous>)
at traverseNode (/Users/goose/Documents/programming/ai-monsters/node_modules/nx/src/plugins/js/lock-file/project-graph-pruning.js:78:36)
Package Manager Version
yarn v1.22.19
Operating System
[X] macOS
[ ] Linux
[ ] Windows
[ ] Other (Please specify)
Additional Information
This issue is not that big of a deal as I have found a workaround; I am using this proxy script so that it does not show the error in the console.
import * as pty from 'node-pty';
import os from 'os';
export async function emaulateServer() {
const filters = [
'An error occured while creating pruned lockfile',
'Target project does not exist: npm:tmp@0.0.33',
'plugins/js/lock-file/project-graph-pruning.js',
'project-graph-builder.js',
];
Current Behavior
When building a nestjs project with NX in monorepo, it shoots an annoying error where it cant find an npm package. This has already been described in #15835 however this issue still occurs.
Expected Behavior
I'd like the console to not reflect the error
GitHub Repo
Its private because contains my companies IP
Steps to Reproduce
1.Make an NX project
Nx Report
Failure Logs
Package Manager Version
yarn v1.22.19
Operating System
Additional Information
This issue is not that big of a deal as I have found a workaround; I am using this proxy script so that it does not show the error in the console.
import * as pty from 'node-pty'; import os from 'os';
export async function emaulateServer() { const filters = [ 'An error occured while creating pruned lockfile', 'Target project does not exist: npm:tmp@0.0.33', 'plugins/js/lock-file/project-graph-pruning.js', 'project-graph-builder.js', ];
runProcess('nx build server', '--watch').execScript(...filters); runProcess('firebase emulators:start --only functions,firestore').execScript( ...filters ); }
function runProcess(command: string, ...args: string[]) { return { execScript: (...filters) => { return run(command, filters, args); }, }; }
function run(command: string, filterList: Array, args: string[]) {
const shell = os.platform() === 'win32' ? 'powershell.exe' : 'bash';
const child = pty.spawn(shell, [], { name: 'xterm-color', cols: 80, rows: 30, cwd: process.env.PWD, env: process.env, });
child.write(
${command} ${args.join(' ')}\r
);child.onData(function (data) { if (!filterList.some((filter) => data.includes(filter))) { process.stdout.write(data); } }); }