Skip to content

Angular CLI 1.7.3 Cannot find module '@angular-devkit/build-optimizer' #10019

@devforey

Description

@devforey

Versions

<!--
Angular CLI: 1.7.3
Node: 9.8.0
OS: darwin x64
Angular: 5.2.9
... animations, common, compiler, compiler-cli, core, forms
... http, platform-browser, platform-browser-dynamic
... platform-server, router

@angular/cdk: 5.2.4
@angular/cli: 1.7.3
@angular/flex-layout: 5.0.0-beta.13
@angular/material: 5.2.4
@schematics/package-update: 0.3.2
typescript: 2.5.3
webpack-node-externals: 1.6.0
webpack: 3.10.0

Repro steps

  • npm run build:prod

Observed behavior

Cannot find module '@angular-devkit/build-optimizer' from '/my/project/directory'
Error: Cannot find module '@angular-devkit/build-optimizer' from '/my/project/directory'
    at Function.module.exports [as sync] (/my/project/directory/node_modules/resolve/lib/sync.js:40:15)
    at Object.getCommonConfig (/my/project/directory/node_modules/@angular/cli/models/webpack-configs/common.js:138:56)
    at NgCliWebpackConfig.buildConfig (/my/project/directory/node_modules/@angular/cli/models/webpack-config.js:33:31)
    at Class.run (/my/project/directory/node_modules/@angular/cli/tasks/build.js:31:92)
    at Class.run (/my/project/directory/node_modules/@angular/cli/commands/build.js:250:40)
    at resolve (/my/project/directory/node_modules/@angular/cli/ember-cli/lib/models/command.js:261:20)
    at new Promise (<anonymous>)
    at Class.validateAndRun (/my/project/directory/node_modules/@angular/cli/ember-cli/lib/models/command.js:240:12)
    at Promise.resolve.then.then (/my/project/directory/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:140:24)
    at <anonymous>
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! search@0.0.0 build:prod: `ng build --prod`
npm ERR! Exit status 1
npm ERR! 
npm ERR! Failed at the search@0.0.0 build:prod script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.

npm ERR! A complete log of this run can be found in:
npm ERR!     /Users/Mark/.npm/_logs/2018-03-20T12_06_15_012Z-debug.log

Desired behavior

To build prod without error

Mention any other details that might be useful (optional)

My project's package.json

"dependencies": {
    "@angular/animations": "^5.2.9",
    "@angular/cdk": "^5.2.4",
    "@angular/common": "^5.2.0",
    "@angular/compiler": "^5.2.0",
    "@angular/core": "^5.2.0",
    "@angular/flex-layout": "^5.0.0-beta.13",
    "@angular/forms": "^5.2.0",
    "@angular/http": "^5.2.0",
    "@angular/material": "^5.2.4",
    "@angular/platform-browser": "^5.2.0",
    "@angular/platform-browser-dynamic": "^5.2.0",
    "@angular/platform-server": "^5.2.9",
    "@angular/router": "^5.2.0",
    "@ngrx/effects": "^4.1.0",
    "@ngrx/store": "^4.1.0",
    "@nguniversal/express-engine": "^5.0.0-beta.6",
    "@nguniversal/module-map-ngfactory-loader": "^5.0.0-beta.6",
    "@ngx-translate/core": "^9.1.1",
    "@ngx-translate/http-loader": "^2.0.1",
    "bodybuilder": "2.2.1",
    "core-js": "^2.4.1",
    "elasticsearch": "^13.3.1",
    "hammerjs": "^2.0.8",
    "intl": "^1.2.5",
    "jsdom": "^11.6.2",
    "jsdom-global": "^3.0.2",
    "libphonenumber-js": "^1.0.24",
    "rxjs": "^5.5.6",
    "ts-loader": "^3.5.0",
    "web-animations-js": "^2.3.1",
    "zone.js": "^0.8.19"
  },
  "devDependencies": {
    "@angular/cli": "~1.7.3",
    "@angular/compiler-cli": "^5.2.0",
    "@ngrx/store-devtools": "^4.0.0",
    "@types/googlemaps": "^3.30.0",
    "@types/jasmine": "~2.8.3",
    "@types/node": "~6.0.60",
    "codelyzer": "^4.0.1",
    "jasmine-core": "~2.8.0",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-cli": "~1.0.1",
    "karma-coverage-istanbul-reporter": "^1.2.1",
    "karma-jasmine": "~1.1.0",
    "karma-jasmine-html-reporter": "^0.2.2",
    "node-sass": "^4.7.2",
    "protractor": "~5.1.2",
    "ts-node": "~4.1.0",
    "tslint": "~5.9.1",
    "typescript": "~2.5.3",
    "webpack": "^3.10.0",
    "webpack-node-externals": "^1.6.0"
  }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions