Skip to content
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

Error to execute: migration-v10-missing-injectable #3464

Closed
tiaguinho opened this issue Aug 3, 2020 · 8 comments
Closed

Error to execute: migration-v10-missing-injectable #3464

tiaguinho opened this issue Aug 3, 2020 · 8 comments
Assignees
Labels
blocked: retry with latest Retry with latest release or head. outdated scope: angular Issues related to Angular support in Nx stale type: bug

Comments

@tiaguinho
Copy link

Current Behavior

The command nx migrate --run-migrations=migrations.json is giving me the error:

Could not find any tsconfig file. Cannot add the "@Injectable" decorator to providers which don't have that decorator set.
/home/temporin/workspace/builders/node_modules/yargs/yargs.js:1109
      else throw err
           ^

Error: Command failed: ./node_modules/.bin/tao migrate --run-migrations=migrations.json
    at checkExecSyncError (child_process.js:629:11)
    at Object.execSync (child_process.js:666:13)
    at Object.exports.commandsObject.yargs.usage.command.command.command.command.command.command.command.command.command.command.command.command.command.command.command.alias.command.command.command [as handler] (/home/temporin/workspace/builders/node_modules/@nrwl/workspace/src/command-line/nx-commands.js:77:21)
    at Object.runCommand (/home/temporin/workspace/builders/node_modules/yargs/lib/command.js:235:44)
    at Object.parseArgs [as _parseArgs] (/home/temporin/workspace/builders/node_modules/yargs/yargs.js:1022:30)
    at Object.get [as argv] (/home/temporin/workspace/builders/node_modules/yargs/yargs.js:965:21)
    at Object.initLocal (/home/temporin/workspace/builders/node_modules/@nrwl/cli/lib/init-local.js:24:13)
    at Object.<anonymous> (/home/temporin/workspace/builders/node_modules/@nrwl/cli/bin/nx.js:12:18)
    at Module._compile (internal/modules/cjs/loader.js:778:30)
    at Object.Module._extensions..js (internal/modules/cjs/loader.js:789:10)

After I talk with @devversion about this problem, I realize that Angular migration only checks for angular.json and .angular.json files to find the projects inside the workspace.

Since NX workspace is defined on workspace.json, the migration can't find any project to migrate.
I put the logs from the execution in the logs section.

Expected Behavior

Migrate

Steps to Reproduce

A project with two or more apps and a few libraries

Logs

defaultWorkspceConfigPath - [ '/angular.json', '/.angular.json' ]
getProjectTsConfigPaths: tree param - HostTree {
  _backend:
   ScopedHost {
     _delegate: NodeJsSyncHost {},
     _root: '/home/temporin/workspace/builders' },
  _id: -1,
  _ancestry: Set {},
  _dirCache: Map {},
  _record:
   CordHost {
     _cache: Map { '/' => <Directory> },
     _watchers: Map {},
     _back: SafeReadonlyHost { _delegate: [ScopedHost] },
     _filesToCreate: Set {},
     _filesToRename: Map {},
     _filesToRenameRevert: Map {},
     _filesToDelete: Set {},
     _filesToOverwrite: Set {} },
  _recordSync:
   SyncDelegateHost {
     _delegate:
      CordHost {
        _cache: [Map],
        _watchers: Map {},
        _back: [SafeReadonlyHost],
        _filesToCreate: Set {},
        _filesToRename: Map {},
        _filesToRenameRevert: Map {},
        _filesToDelete: Set {},
        _filesToOverwrite: Set {} } } }
getProjectTsConfigPaths: workspace var - null

Environment

nx : Not Found
@nrwl/angular : 10.0.7
@nrwl/cli : 10.0.7
@nrwl/cypress : 10.0.7
@nrwl/eslint-plugin-nx : 10.0.7
@nrwl/express : Not Found
@nrwl/jest : 10.0.7
@nrwl/linter : 10.0.7
@nrwl/nest : Not Found
@nrwl/next : Not Found
@nrwl/node : 10.0.7
@nrwl/react : Not Found
@nrwl/schematics : Not Found
@nrwl/tao : 10.0.7
@nrwl/web : Not Found
@nrwl/workspace : 10.0.7
typescript : 3.9.7

@georgiee
Copy link

georgiee commented Aug 5, 2020

I have the same issue. Monkey patching the angular/core file to add workspace.json helped me to the next migration.

File : node_modules/@angular/core/schematics/utils/project_tsconfig_paths.js

/** Name of the default Angular CLI workspace configuration files. */
    const defaultWorkspaceConfigPaths = ['/angular.json', '/.angular.json', '/workspace.json'];

Next error:

Running migration @nrwl/angular:update-10-0-0
    Updating @angular/cli to 10.0.0


Error: Cannot find module 'node_modules/@angular/cli/bin/ng
@angular/cli migration failed, see above.

Of course I have no ng available when I rely on the Nx CLI. I can't believe this slipped through Nx's testing or that this fails for everyone. The renamed workspace is something so common it must be handled by Nx for every past Angular migration. Is something else failing in our workspaces?

@beeman
Copy link
Contributor

beeman commented Aug 25, 2020

Running into the same issue.

I worked around it by symlinking workspace.json to angular.json:

ln -s workspace.json angular.json

@brandonroberts I got a repro. Can't make the repository public as it's not open source, but I can share it with you if that helps.

@michael-letcher
Copy link

Does anyone have a solution? Is it to do that solution mentioned by @beeman then install separately the @angular/cli to avoid the issue described by @georgiee?

@beeman
Copy link
Contributor

beeman commented Aug 30, 2020

I didn't install the Angular CLI. What I did do though, is after the first failure, I rolled back any local changes the upgrade made, created the symlink and ran the upgrade again. Not sure if that made the difference but it's what worked for me.

@brandonroberts
Copy link
Contributor

Just leaving an update here, but we are looking into this issue for a more permanent fix. The workaround mentioned above works for now.

@brandonroberts
Copy link
Contributor

Has anyone tried this with the latest release? I believe we landed some changes for better support inside a "vanilla" Nx workspace

@brandonroberts brandonroberts added the blocked: retry with latest Retry with latest release or head. label Jan 29, 2021
@github-actions
Copy link

This issue has been automatically marked as stale because it hasn't had any recent activity. It will be closed in 14 days if no further activity occurs.
If we missed this issue please reply to keep it active.
Thanks for being a part of the Nx community! 🙏

@github-actions
Copy link

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.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 24, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
blocked: retry with latest Retry with latest release or head. outdated scope: angular Issues related to Angular support in Nx stale type: bug
Projects
None yet
Development

No branches or pull requests

6 participants