nrwl / nx

Smart Monorepos · Fast CI
https://nx.dev
MIT License
23.58k stars 2.36k forks source link

Generating new libs doesnt work after generating one lib #647

Closed peb7268 closed 6 years ago

peb7268 commented 6 years ago

If I run the generate command like so:

ng g lib shared/client

it works correctly the first time but when I try to run it a subsequent time ng g lib shared/server it fails. Here is the error message:

ENOENT: no such file or directory, stat 'mypath/myworkspace/node_modules/@angular-devkit/build-angular/node_modules/@angular-devkit/build-webpack/node_modules/.bin/webpack-dev-server'

Removing and reinstalling @angular-devkit/build-angular seems to let me re-run the command but it breaks again after 1 use.

Here is my version info:


/ \   _ __   __ _ _   _| | __ _ _ __     / ___| |   |_ _|

/ △ \ | ' \ / | | | | |/ _ | '| | | | | | | / _ | | | | (| | || | | (| | | | || |_ | | // __| ||_, |_,||_,|| __|__|| |/

Angular CLI: 6.0.1 Node: 8.11.2 OS: darwin x64 Angular: 6.0.1 ... animations, cli, common, compiler, core, forms ... language-service, platform-browser, platform-browser-dynamic ... router

Package Version

@angular-devkit/architect 0.6.8 @angular-devkit/build-angular 0.7.1 @angular-devkit/build-ng-packagr 0.6.8 @angular-devkit/build-webpack 0.7.1 @angular-devkit/core 0.6.8 @angular-devkit/schematics 0.6.1 @angular/compiler-cli 6.0.3 @angular/platform-server 2.4.10 @angular/tsc-wrapped 0.5.2 @ngtools/json-schema 1.1.0 @schematics/angular 0.6.1 @schematics/update 0.6.1 ng-packagr 3.0.3 rxjs 6.2.1 typescript 2.7.2 webpack 4.16.0

vsavkin commented 6 years ago

are you using Yarn or Npm?

lexcaraig commented 6 years ago

Had the same issue, I'd tried deleting node_modules then install packages using yarn. Works fine.

peb7268 commented 6 years ago

Im using NPM currently.

I think it must be an issue with my package.json in that project because if I create a new workspace then it works fine there.

I actually already tried deleting my node_modules folder and re-installing. Im going to compare my deps in the package.json to that in the newly generated workspace I just did. Maybe I got something switched around when I was troubleshooting things.

peb7268 commented 6 years ago

Ok. So I moved my apps directory, angular.json, and nx.json to a freshly generated workspace from my current app I was troubleshooting. After moving them over NX worked fine for generating a few test libs. Once I installed the deps from my package.json though weird behavior started again.

I can ran the ng generate lib test5 command and it worked fine other than taking a lot longer than usual and showing some strange post nx output in the console.

When I try to run the command again and generate another lib nx no longer works and I get the error message: ENOENT: no such file or directory, stat 'myworkspace/node_modules/bcrypt/node_modules/.bin/node-pre-gyp'

Here is the full output from the terminal: https://cl.ly/2h032t040N3j https://cl.ly/2a222p2V1x1J

and here is my package.json in case that helps:

{
  "name": "myworkspace",
  "version": "0.0.0",
  "license": "MIT",
  "scripts": {
    "ng": "ng",
    "start": "npm run intengoadmin & npm run pairwise",
    "intengoadmin": "npm run IA:watch:be & npm run IA:serve:fe",
    "IA:serve:fe": "ng serve intengoadmin --host 0.0.0.0 --port 3000 --proxy-config ./apps/intengoadmin/proxy.conf.json",
    "IA:watch:be": "webpack --mode=development --config ./apps/intengoadmin/webpack.config.js --watch",
    "IA:docker": "IS_DOCKER=true node ./apps/intengoadmin/dist/server.bundle.js",
    "intengofe": "npm run IF:watch:be & npm run IF:serve:fe",
    "IF:serve:fe": "ng serve intengofe --host 0.0.0.0 --port 8000 --proxy-config ./apps/intengofe/proxy.conf.json",
    "IF:watch:be": "webpack --mode=development --config ./apps/intengofe/webpack.config.js --watch",
    "IF:docker": "IS_DOCKER=true node ./apps/intengofe/dist/server.bundle.js",
    "pairwise": "npm run PW:serve:fe & npm run PW:watch:be",
    "PW:serve:fe": "ng serve pairwise --host 0.0.0.0 --port 4200 --proxy-config ./apps/pairwise/proxy.conf.json",
    "PW:watch:be": "webpack --mode=development --config ./apps/pairwise/webpack.config.js --watch",
    "PW:docker": "IS_DOCKER=true node ./apps/pairwise/dist/server.bundle.js",
    "test": "ng test",
    "lint": "./node_modules/.bin/nx lint && ng lint",
    "e2e": "ng e2e",
    "affected:apps": "./node_modules/.bin/nx affected:apps",
    "affected:build": "./node_modules/.bin/nx affected:build",
    "affected:e2e": "./node_modules/.bin/nx affected:e2e",
    "affected:test": "./node_modules/.bin/nx affected:test",
    "affected:lint": "./node_modules/.bin/nx affected:lint",
    "affected:dep-graph": "./node_modules/.bin/nx affected:dep-graph",
    "format": "./node_modules/.bin/nx format:write",
    "format:write": "./node_modules/.bin/nx format:write",
    "format:check": "./node_modules/.bin/nx format:check",
    "update": "ng update @nrwl/schematics",
    "update:check": "ng update",
    "workspace-schematic": "./node_modules/.bin/nx workspace-schematic",
    "dep-graph": "./node_modules/.bin/nx dep-graph",
    "help": "./node_modules/.bin/nx help",
    "clean": "npx rimraf hooks node_modules yarn.lock && yarn"
  },
  "private": true,
  "dependencies": {
    "@angular/common": "6.0.1",
    "@angular/core": "6.0.1",
    "@angular/compiler": "6.0.1",
    "@angular-redux/store": "^9.0.0",
    "@angular/animations": "6.0.1",
    "@angular/forms": "6.0.1",
    "@angular/platform-browser": "6.0.1",
    "@angular/platform-browser-dynamic": "6.0.1",
    "@angular/router": "6.0.1",
    "@auth0/angular-jwt": "^2.0.0",
    "@cloudinary/angular": "^2.1.1",
    "@ngrx/effects": "5.2.0",
    "@ngrx/router-store": "5.2.0",
    "@ngrx/store": "5.2.0",
    "@ngrx/store-devtools": "5.2.0",
    "@nrwl/nx": "6.1.1",
    "apollo-angular": "^1.1.2",
    "apollo-angular-link-http": "^1.1.1",
    "apollo-cache-inmemory": "^1.3.0-beta.6",
    "apollo-client": "^2.3.7",
    "aws-sdk": "^2.283.1",
    "bcrypt": "^3.0.0",
    "bcrypt-pbkdf": "^1.0.2",
    "body-parser": "^1.18.3",
    "cloudinary": "^1.11.0",
    "cloudinary-core": "^2.5.0",
    "connect-flash": "^0.1.1",
    "cookie-parser": "^1.4.3",
    "core-js": "^2.5.4",
    "cors": "^2.8.4",
    "dotenv": "^6.0.0",
    "dragula": "^3.7.2",
    "dropzone": "^5.5.1",
    "engine.io": "^3.2.0",
    "engine.io-client": "^3.2.1",
    "engine.io-parser": "^2.1.2",
    "express": "^4.16.3",
    "express-graphql": "^0.6.12",
    "express-session": "^1.15.6",
    "graphql": "^0.13.2",
    "graphql-tag": "^2.9.2",
    "graphql-type-json": "^0.2.1",
    "intl": "^1.2.5",
    "jquery": "^3.3.1",
    "json2csv": "^4.1.6",
    "jsonwebtoken": "^8.3.0",
    "mongoose": "^4.13.11",
    "morgan": "^1.9.0",
    "ng2-dragula": "^2.0.2",
    "ngrx-store-freeze": "0.2.2",
    "node-sass": "^4.9.2",
    "passport": "^0.4.0",
    "passport-github": "^1.1.0",
    "passport-google-oauth": "^1.0.0",
    "passport-jwt": "^4.0.0",
    "passport-linkedin": "^1.0.0",
    "passport-local": "^1.0.0",
    "redux": "^4.0.0",
    "request-promise": "^4.2.2",
    "rxjs": "6.0.0",
    "rxjs-compat": "6.0.0",
    "shebang-loader": "^0.0.1",
    "socket.io": "^2.1.1",
    "winston": "^3.0.0",
    "zone.js": "^0.8.26"
  },
  "devDependencies": {
    "@angular/compiler-cli": "6.0.1",
    "@angular-devkit/build-ng-packagr": "~0.6.1",
    "@angular-devkit/build-angular": "~0.6.1",
    "ng-packagr": "^3.0.0-rc.2",
    "tsickle": ">=0.25.5",
    "tslib": "^1.7.1",
    "typescript": "2.7.2",
    "@angular/cli": "6.0.1",
    "@angular/language-service": "6.0.1",
    "@ngrx/schematics": "5.2.0",
    "@nrwl/schematics": "6.1.1",
    "@types/jasmine": "~2.8.6",
    "@types/jasminewd2": "~2.0.3",
    "@types/node": "~8.9.4",
    "codelyzer": "~4.2.1",
    "jasmine-core": "~2.99.1",
    "jasmine-marbles": "0.3.1",
    "jasmine-spec-reporter": "~4.2.1",
    "karma": "~2.0.0",
    "karma-chrome-launcher": "~2.2.0",
    "karma-coverage-istanbul-reporter": "~1.4.2",
    "karma-jasmine": "~1.1.0",
     "karma-jasmine-html-reporter": "^0.2.2",
     "nodemon": "^1.18.3",
    "phantomjs-prebuilt": "^2.1.16",
    "prettier": "1.10.2",
    "protractor": "~5.3.0",
     "ts-node": "~5.0.1",
     "ts-loader": "^4.4.2",
     "tslint": "~5.9.1",
     "webpack-cli": "^2.1.3",
    "webpack-dev-middleware": "~3.1.3",
    "webpack-dev-server": "^3.1.5",
    "webpack-shell-plugin": "^0.5.0"
  }
}
peb7268 commented 6 years ago

Seems related to this issue: https://github.com/nrwl/nx/issues/536

bcabanes commented 6 years ago

Related issue closed. Closing this issue as well.

github-actions[bot] commented 1 year ago

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.