angular / angular-cli

CLI tool for Angular
https://cli.angular.io
MIT License
26.77k stars 11.97k forks source link

Could not find module @schematics/angular when creating new project #9354

Closed StevenFewster closed 6 years ago

StevenFewster commented 6 years ago

System Win x64 OS Windows 7 Enterprise

Versions

Angular CLI: 1.6.5
Node: 9.2.0
OS: win32 x64
Angular: ...

Repro steps

npm -v
> 5.6.0

npm install -g @angular/cli@1.6.5

ng new marketdata

Observed behavior

Could not find module "@schematics/angular" from "C:\\Development".
Error: Could not find module "@schematics/angular" from "C:\\Development".
    at Object.resolve (\\SysProf\AppData$\fewsts\AppData\Roaming\npm\node_module
s\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:140:11)
    at NodeModulesEngineHost._resolvePackageJson (\\SysProf\AppData$\fewsts\AppD
ata\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematic
s\tools\node-module-engine-host.js:22:21)
    at NodeModulesEngineHost._resolveCollectionPath (\\SysProf\AppData$\fewsts\A
ppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schema
tics\tools\node-module-engine-host.js:43:36)
    at NodeModulesEngineHost.createCollectionDescription (\\SysProf\AppData$\few
sts\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\s
chematics\tools\file-system-engine-host-base.js:102:27)
    at SchematicEngine.createCollection (\\SysProf\AppData$\fewsts\AppData\Roami
ng\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\eng
ine\engine.js:46:40)
    at Object.getCollection (\\SysProf\AppData$\fewsts\AppData\Roaming\npm\node_
modules\@angular\cli\utilities\schematics.js:37:31)
    at Class.run (\\SysProf\AppData$\fewsts\AppData\Roaming\npm\node_modules\@an
gular\cli\tasks\schematic-get-options.js:11:41)
    at Class.beforeRun (\\SysProf\AppData$\fewsts\AppData\Roaming\npm\node_modul
es\@angular\cli\commands\new.js:91:31)
    at Promise.resolve.then (\\SysProf\AppData$\fewsts\AppData\Roaming\npm\node_
modules\@angular\cli\ember-cli\lib\cli\cli.js:138:24)
    at <anonymous>

Desired behavior

Create fresh project in the directory that I was in.

Mention any other details that might be useful (optional)

Attempted fixes include winding back to 1.6.3

npm i -D @angular-devkit/core
npm i -g @angular-devkig/core

Note: This is since doing an install of Node and updgrading to cli 1.6.5

StevenFewster commented 6 years ago

FYI: Resolved

Actions:

npm uninstall -g @angular/cli
yarn global add @angular/cli

After some time trying to resolve, I'm just going to accept that this has worked and move on with my life. hth

jhdcruz commented 6 years ago

You can try/refer to this: https://github.com/angular/angular-cli/issues/7630

ajitsamanta commented 5 years ago

I have tired above solutions but it did not work for me.

Versions details:

Angular CLI: 7.3.9 Node: 10.15.3 OS: win32 x64 Angular: ...

Package Version

@angular-devkit/architect 0.13.9 @angular-devkit/core 7.3.9 @angular-devkit/schematics 7.3.9 @schematics/angular 7.3.9 @schematics/update 0.13.9 rxjs 6.3.3 typescript 3.2.4

Error:

Could not find module "@schematics/angular" from "C:\Test\Projects\DemoNGApp". Error: Could not find module "@schematics/angular" from "C:\Test\Projects\DemoNGApp". at Object.resolve (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\core\node\resolve.js:141:11) at NodeModulesEngineHost._resolvePackageJson (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:28:21) at NodeModulesEngineHost._resolveCollectionPath (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\node-module-engine-host.js:69:40) at NodeModulesEngineHost.createCollectionDescription (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\tools\file-system-engine-host-base.js:111:27) at SchematicEngine._createCollectionDescription (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:147:40) at SchematicEngine.createCollection (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\node_modules\@angular-devkit\schematics\src\engine\engine.js:140:43) at NewCommand.getCollection (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\models\schematic-command.js:123:35) at NewCommand.initialize (\my.client.net\ViewData\Users\username\AppData\Roaming\npm\node_modules\@angular\cli\models\schematic-command.js:42:37) at process._tickCallback (internal/process/next_tick.js:68:7) at Function.Module.runMain (internal/modules/cjs/loader.js:757:11) at startup (internal/bootstrap/node.js:283:19) at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

Please help me.

ajitsamanta commented 5 years ago

I resolved it by installing the @schematics/angular

marcomatutehn commented 5 years ago

I resolved it by installing the @schematics/angular

It works, thanks a lot.

oussamaelhajoui commented 5 years ago

FYI: Resolved

Actions:

npm uninstall -g @angular/cli
yarn global add @angular/cli

After some time trying to resolve, I'm just going to accept that this has worked and move on with my life. hth

No, this did not work...

angular-automatic-lock-bot[bot] commented 5 years ago

This issue has been automatically locked due to inactivity. Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.