Closed danthedaniel closed 2 years ago
I realized that nx migrate latest
didn't update the nx
package itself, so I did that manually (upgrading nx to 13.2.3) and then ran the migration commands in my post above. The results were the same:
npx nx migrate --run-migrations § 4:09PM !2028
> NX Running 'npm install' to make sure necessary packages are installed
npm WARN old lockfile
npm WARN old lockfile The package-lock.json file was created with an old version of npm,
npm WARN old lockfile so supplemental metadata must be fetched from the registry.
npm WARN old lockfile
npm WARN old lockfile This is a one-time fix-up, please be patient...
npm WARN old lockfile
added 410 packages, removed 1205 packages, changed 433 packages, and audited 4350 packages in 28s
349 packages are looking for funding
run `npm fund` for details
47 vulnerabilities (36 moderate, 11 high)
To address issues that do not require attention, run:
npm audit fix
To address all issues (including breaking changes), run:
npm audit fix --force
Run `npm audit` for details.
> NX Running migrations from 'migrations.json'
Running migration add-target-dependencies
> NX NOTE Target dependencies have been updated in nx.json
Nx has deprecated strictlyOrderedTargets in favour of targetDependencies.
Based on your configuration the migration has configured targetDependencies for the following targets: build.
Read more here: https://nx.dev/core-concepts/configuration
jsxBracketSameLine is deprecated.
Could not format nx.json. Error: "undefined"
Could not format workspace.json. Error: "undefined"
Could not format tsconfig.base.json. Error: "undefined"
Successfully finished add-target-dependencies
---------------------------------------------------------
Running migration set-default-base-if-not-set
Successfully finished set-default-base-if-not-set
---------------------------------------------------------
Running migration 13-0-0-config-locations
Could not format nx.json. Error: "undefined"
Could not format workspace.json. Error: "undefined"
Successfully finished 13-0-0-config-locations
---------------------------------------------------------
Running migration set-parallel-default
Cannot read property 'default' of undefined
Command failed: /var/folders/qz/jzctsv9j131_w26qqvpjnyq00000gn/T/tmp-29852-6eGe0wu7M7X5/node_modules/.bin/tao migrate --run-migrations
Node : 14.17.0
OS : darwin arm64
npm : 7.24.2
nx : 13.2.3
@nrwl/angular : undefined
@nrwl/cli : 13.2.3
@nrwl/cypress : 13.2.3
@nrwl/devkit : 13.2.3
@nrwl/eslint-plugin-nx : 13.2.3
@nrwl/express : undefined
@nrwl/jest : 13.2.3
@nrwl/linter : 13.2.3
@nrwl/nest : 13.2.3
@nrwl/next : 13.2.3
@nrwl/node : 13.2.3
@nrwl/nx-cloud : undefined
@nrwl/react : 13.2.3
@nrwl/react-native : undefined
@nrwl/schematics : undefined
@nrwl/tao : 13.2.3
@nrwl/web : 13.2.3
@nrwl/workspace : 13.2.3
@nrwl/storybook : 13.2.3
@nrwl/gatsby : undefined
typescript : 4.3.5
rxjs : 6.6.3
---------------------------------------
Community plugins:
When I try to run apps in my workspace I get the error:
$ npx nx run api:build --prod
(node:32508) UnhandledPromiseRejectionWarning: TypeError: Cannot read property 'default' of undefined
at ./node_modules/@nrwl/workspace/src/core/project-graph/project-graph.js:47:77
project-graph.js:47:77
:
function createProjectGraphAsync(projectGraphVersion = '5.0') {
var _a, _b;
return (0, tslib_1.__awaiter)(this, void 0, void 0, function* () {
const nxJson = (0, file_utils_1.readNxJson)();
const useDaemonProcessOption = (_b = (_a = nxJson.tasksRunnerOptions['default']) === null || _a === void 0 ? void 0 : _a.options) === null || _b === void 0 ? void 0 : _b.useDaemonProcess;
if (useDaemonProcessOption !== true && process.env.NX_DAEMON !== 'true') {
return projectGraphAdapter('5.0', projectGraphVersion, yield (0, build_project_graph_1.buildProjectGraph)());
}
const daemonClient = require('./daemon/client/client');
if (!(yield daemonClient.isServerAvailable())) {
yield daemonClient.startInBackground();
}
return projectGraphAdapter('5.0', projectGraphVersion, daemonClient.getProjectGraphFromServer());
});
}
My nx.json
file has no tasksRunnerOptions
key in it at all.
Same issue
@danthedaniel you mentioned nx.json doesn't have taskRunnerOptions at all, can you paste an anonymized version of it here?
@AgentEnder migration do not add taskRunnerOptions to nx.json, this is diff after migration:
diff --git a/nx.json b/nx.json
index e1ccddad3..92d44e657 100644
--- a/nx.json
+++ b/nx.json
@@ -13,265 +13,40 @@
"tslint.json": "*",
"nx.json": "*"
},
- "projects": { ... }
+ "targetDependencies": {},
+ "cli": {
+ "defaultCollection": "@nrwl/angular",
+ "analytics": false
+ },
+ "defaultProject": "oms",
+ "generators": {
+ "@nrwl/angular:application": {
+ "style": "scss",
+ "linter": "eslint",
+ "unitTestRunner": "jest",
+ "e2eTestRunner": "cypress"
+ },
+ "@nrwl/angular:library": {
+ "style": "scss",
+ "linter": "eslint",
+ "unitTestRunner": "jest"
+ },
+ "@nrwl/angular:component": {
+ "style": "scss"
}
},
- "targetDependencies": {}
-}
+}
after adding tasksRunnerOptions manually it works OK
"tasksRunnerOptions": {
"default": {
"runner": "@nrwl/workspace/tasks-runners/default",
"options": {
"cacheableOperations": [
"build",
"lint",
"test",
"e2e"
],
"parallel": 1
}
}
}
Hey, I just looked into this and it was fixed in https://github.com/nrwl/nx/pull/7814, and will be part of 13.3's release. Thanks for reporting this!
I'm going to close out this issue, since the fix has been merged. Feel free to open a new issue if something else comes up, or let me know if you feel the issue needs to be reopened.
This issue has been closed for more than 30 days. If this issue is still occuring, please open a new issue with more recent context.
Current Behavior
I ran the following commands:
And I got the following output
Expected Behavior
I expected the migrations to be applied without errors 😛
Steps to Reproduce
Here are the changes that were applied to my
package.json
:Here are the changes applied to
workspace.json
:Environment
Before:
After: