-
Notifications
You must be signed in to change notification settings - Fork 41
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot find module 'nx/src/utils/app-root' #632
Comments
Hi @Jeff-Stapleton! I'm encountering the exact same problem. I tried to apply the solutions mentioned here, but no luck so far nrwl/nx#4731 Could you paste your report here, using
|
Alright so you probably have to options
|
Same issue here with |
Same issue for angular
|
Same issue. Any progress on this ? Cannot find module 'nx/src/utils/app-root' |
same problem with Angular also. Tried version 12 and it also didn't work for me. |
Downgrading back to 14.1.7 works |
Same issue here
|
Thanks @Tam2 downgrading to 14.1.7 did indeed work. Hopefully this issue will be fixed soon 🤞 |
@dandouglas, @Tam2 - did you downgrade nx and all plugins to 14.1.7? And did you use the nx version migration, or did you just change the versions by hand? Asking because this fix did not work for me. edit:
|
I downgraded NX and all the @nrwl plugins by hand 👍 |
Any updates on this? Unable to create a ionic workspace with nxtend as well. |
This is the same issue as #628 and there's a pull request #638 to address this, but no sign yet from the owner of the repo of getting this merged. Downgrading to it looks like #633 is also affected by nx higher than I do not know if PR #638 covers the issues here and in #633 so there may need to be more changes to handle the different versions between |
For me downgrading NX did not solve the issue. Neither 13.0.0 nor 14.1.7 seemed to do the trick. |
What steps did you take to downgrade? |
I manually changed the versions in package.json to 14.1.7, deleted the node_modules folder and then ran |
And that would be all |
Yes, this is what it looks like:
|
For anyone that want a patch, here. This also includes #633. Detailsdiff --git a/src/executors/run-commands/run-commands.impl.js b/src/executors/run-commands/run-commands.impl.js
index d2c45a4405755b63e541b060f0e7631781f33b9c..052e0a4c172454d8c3cfae567739baa5fc1e3be6 100644
--- a/src/executors/run-commands/run-commands.impl.js
+++ b/src/executors/run-commands/run-commands.impl.js
@@ -190,7 +190,7 @@ function interpolateArgsIntoCommand(command, opts, forwardAllArgs) {
return command.replace(regex, (_, group) => opts.parsedArgs[group]);
}
else if (forwardAllArgs) {
- return `${command}${opts.__unparsed__.length > 0 ? ' ' + opts.__unparsed__.join(' ') : ''}`;
+ return `${command}${opts.__unparsed__?.length > 0 ? ' ' + opts.__unparsed__.join(' ') : ''}`;
}
else {
return command;
diff --git a/src/utils/app-root.d.ts b/src/utils/app-root.d.ts
new file mode 100644
index 0000000000000000000000000000000000000000..9d8d8966d6d98539c395ce6d7c95333f7ab35474
--- /dev/null
+++ b/src/utils/app-root.d.ts
@@ -0,0 +1,11 @@
+/**
+ * The root of the workspace.
+ *
+ * @deprecated use workspaceRoot instead
+ */
+export declare const appRootPath: string;
+/**
+ * The root of the workspace
+ */
+export declare const workspaceRoot: string;
+export declare function fileExists(filePath: string): boolean;
diff --git a/src/utils/app-root.js b/src/utils/app-root.js
new file mode 100644
index 0000000000000000000000000000000000000000..440e99787ed3facbe77e036f17d7f49ff90789cb
--- /dev/null
+++ b/src/utils/app-root.js
@@ -0,0 +1,39 @@
+"use strict";
+Object.defineProperty(exports, "__esModule", { value: true });
+exports.fileExists = exports.workspaceRoot = exports.appRootPath = void 0;
+const path = require("path");
+const fs_1 = require("fs");
+/**
+ * The root of the workspace.
+ *
+ * @deprecated use workspaceRoot instead
+ */
+exports.appRootPath = pathInner(__dirname);
+/**
+ * The root of the workspace
+ */
+exports.workspaceRoot = exports.appRootPath;
+function pathInner(dir) {
+ if (process.env.NX_WORKSPACE_ROOT_PATH)
+ return process.env.NX_WORKSPACE_ROOT_PATH;
+ if (path.dirname(dir) === dir)
+ return process.cwd();
+ if (fileExists(path.join(dir, 'workspace.json')) ||
+ fileExists(path.join(dir, 'nx.json')) ||
+ fileExists(path.join(dir, 'angular.json'))) {
+ return dir;
+ }
+ else {
+ return pathInner(path.dirname(dir));
+ }
+}
+function fileExists(filePath) {
+ try {
+ return (0, fs_1.statSync)(filePath).isFile();
+ }
+ catch (err) {
+ return false;
+ }
+}
+exports.fileExists = fileExists;
+//# sourceMappingURL=app-root.js.map
\ No newline at end of file
diff --git a/src/utils/app-root.js.map b/src/utils/app-root.js.map
new file mode 100644
index 0000000000000000000000000000000000000000..d8068dc95b667de1d6c5f5af8d2fd616ed328f97
--- /dev/null
+++ b/src/utils/app-root.js.map
@@ -0,0 +1 @@
+{"version":3,"file":"app-root.js","sourceRoot":"","sources":["../../../../../packages/nx/src/utils/app-root.ts"],"names":[],"mappings":";;;AAAA,6BAA6B;AAC7B,2BAA8B;AAE9B;;;;GAIG;AACU,QAAA,WAAW,GAAG,SAAS,CAAC,SAAS,CAAC,CAAC;AAEhD;;GAEG;AACU,QAAA,aAAa,GAAG,mBAAW,CAAC;AAEzC,SAAS,SAAS,CAAC,GAAW;IAC5B,IAAI,OAAO,CAAC,GAAG,CAAC,sBAAsB;QACpC,OAAO,OAAO,CAAC,GAAG,CAAC,sBAAsB,CAAC;IAC5C,IAAI,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,GAAG;QAAE,OAAO,OAAO,CAAC,GAAG,EAAE,CAAC;IACpD,IACE,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,gBAAgB,CAAC,CAAC;QAC5C,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,SAAS,CAAC,CAAC;QACrC,UAAU,CAAC,IAAI,CAAC,IAAI,CAAC,GAAG,EAAE,cAAc,CAAC,CAAC,EAC1C;QACA,OAAO,GAAG,CAAC;KACZ;SAAM;QACL,OAAO,SAAS,CAAC,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,CAAC,CAAC;KACrC;AACH,CAAC;AAED,SAAgB,UAAU,CAAC,QAAgB;IACzC,IAAI;QACF,OAAO,IAAA,aAAQ,EAAC,QAAQ,CAAC,CAAC,MAAM,EAAE,CAAC;KACpC;IAAC,OAAO,GAAG,EAAE;QACZ,OAAO,KAAK,CAAC;KACd;AACH,CAAC;AAND,gCAMC"}
\ No newline at end of file How?
|
How and where can I apply this patch? |
@orl99 I have updated my answer. But have a look at yarn or pnpm |
Would https://www.npmjs.com/package/patch-package work? |
Thanks a lot! This worked for us |
Still waiting for an "official" fix. |
These plugins are moving over to the Nxext repo, and an Nx 14 version has been released. There are some migration guides on their docs site, here's a link to the Ionic Angular guide: https://nxext.dev/docs/ionic-angular/migrating-from-nxtend.html |
I am trying to create an NX monorepo for an ionic react app I am building.
I create the nx workspace like so:
npx create-nx-workspace my-org --preset=empty
Then I installed installed the required dependencies:
npm install --save-dev --exact @nxtend/ionic-react @nxtend/capacitor @nrwl/react
Finally I am trying to generate my ionic-react app using the following command:
nx generate @nxtend/ionic-react:application myApp
However I am getting the following error:
For the sake of being thurough I will include my entire
package.json
here in case the problem is with my specific version:The text was updated successfully, but these errors were encountered: