angular-cli icon indicating copy to clipboard operation
angular-cli copied to clipboard

ng build fails

Open dalesbit opened this issue 10 years ago • 6 comments

ng build: BuildingENOENT: no such file or directory, open \src\client\tsconfig.json'

Windows 7 node: v4.3.0 npm: 2.14.12 angular-cli: 0.0.30

What i did: npm update the cli was specified in the package.json ("angular-cli": "0.0.*") now its specific to 0.0.30, i tried 0.0.29 which give me:

 csucsi@csucsi-PC  /cygdrive/c/Users/csucsi/Documents/work/slaychat/src  ng build
BuildingCannot read property 'map' of undefined
TypeError: Cannot read property 'map' of undefined
    at Angular2App.toTree (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\lib\broccoli\angular2-app.js:64:34)
    at module.exports (C:\Users\csucsi\Documents\work\slaychat\angular-cli-build.js:9:14)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\models\builder.js:55:19)
    at Class.module.exports.Task.extend.init (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\models\builder.js:89:10)
    at new Class (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\node_modules\core-object\core-object.js:18:12)
    at Class.module.exports.Task.extend.run (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\tasks\build.js:15:19)
    at C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\commands\build.js:28:24
    at lib$rsvp$$internal$$tryCatch (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1036:16)
    at lib$rsvp$$internal$$invokeCallback (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1048:17)
    at lib$rsvp$$internal$$publish (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\node_modules\rsvp\dist\rsvp.js:1019:11)

Full log with version 0.0.30:

 csucsi@csucsi-PC  /cygdrive/c/Users/csucsi/Documents/work/slaychat/src  ng build
BuildingENOENT: no such file or directory, open 'C:\Users\csucsi\Documents\work\slaychat\src\client\tsconfig.json'
Error: ENOENT: no such file or directory, open 'C:\Users\csucsi\Documents\work\slaychat\src\client\tsconfig.json'
    at Error (native)
    at Object.fs.openSync (fs.js:549:18)
    at Object.fs.readFileSync (fs.js:397:15)
    at Angular2App.toTree.Angular2App._getTsTree (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\lib\broccoli\angular2-app.js:229:32)
    at Angular2App.toTree (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\lib\broccoli\angular2-app.js:37:21)
    at module.exports (C:\Users\csucsi\Documents\work\slaychat\angular-cli-build.js:9:14)
    at Class.module.exports.Task.extend.setupBroccoliBuilder (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\models\builder.js:55:19)
    at Class.module.exports.Task.extend.init (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\models\builder.js:89:10)
    at new Class (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\node_modules\core-object\core-object.js:18:12)
    at Class.module.exports.Task.extend.run (C:\Users\csucsi\Documents\work\slaychat\node_modules\angular-cli\node_modules\angular-cli\lib\tasks\build.js:15:19)
 ✘  csucsi@csucsi-PC  /cygdrive/c/Users/csucsi/Documents/work/slaychat/src 

Toughts:

It's just can find the tsconfig in a non existing folder, somehow its trying to look it up deeper than it should.

  • src
    • tsconfig.js

and not

  • src
    • client
      • tsconfig.js

dalesbit avatar Apr 07 '16 10:04 dalesbit

In angular-cli 0.0.30 there's a client folder between src/ and app. So now, when you generate a project, it's src/client/app not src/app.

See https://github.com/angular/angular-cli/commit/a5ddd75f3f11a2a7b267e6c242f983c3594a8765 for more information

0x-r4bbit avatar Apr 07 '16 12:04 0x-r4bbit

@PascalPrecht Thanks, gonna close this then.

dalesbit avatar Apr 07 '16 12:04 dalesbit

@PascalPrecht is correct, there is now a client directory between src and app if you're upgrading the CLI for an existing project, please add that folder manually and move app inside of the new client dir

Brocco avatar Apr 08 '16 12:04 Brocco

Hi, I am getting error when deploying in server but not in local environment - why ?

Your global Angular CLI version (1.0.6) is greater than your local
version (1.0.3). The local Angular CLI version is used.
To disable this warning use "ng set --global warnings.versionMismatch=false".
ENOENT: no such file or directory, stat '/source/src/tsconfig.json'
Error: ENOENT: no such file or directory, stat '/source/src/tsconfig.json'
at Error (native)
at Object.fs.statSync (fs.js:987:18)
at AotPlugin._setupOptions (/source/node_modules/@ngtools/webpack/src/plugin.js:58:16)
at new AotPlugin (/source/node_modules/@ngtools/webpack/src/plugin.js:26:14)
at _createAotPlugin (/source/node_modules/@angular/cli/models/webpack-configs/typescript.js:55:12)
at Object.exports.getAotConfig (/source/node_modules/@angular/cli/models/webpack-configs/typescript.js:89:19)
at NgCliWebpackConfig.buildConfig (/source/node_modules/@angular/cli/models/webpack-config.js:26:37)
at Class.run (/source/node_modules/@angular/cli/tasks/build.js:26:92)
at Class.run (/source/node_modules/@angular/cli/commands/build.js:143:26)
at Class.Command.validateAndRun (/source/node_modules/@angular/cli/ember-cli/lib/models/command.js:128:15)
at /source/node_modules/@angular/cli/ember-cli/lib/cli/cli.js:92:22
at tryCatch (/source/node_modules/rsvp/dist/rsvp.js:539:12)
at invokeCallback (/source/node_modules/rsvp/dist/rsvp.js:554:13)
at /source/node_modules/rsvp/dist/rsvp.js:629:16
at flush (/source/node_modules/rsvp/dist/rsvp.js:2414:5)
at _combinedTickCallback (internal/process/next_tick.js:67:7)

https://stackoverflow.com/questions/44215641/enoent-no-such-file-or-directory-stat-source-src-tsconfig-json-angular-cl

mac10046 avatar May 27 '17 10:05 mac10046

try running this command npm install -g @angular/cli. This issue can occur after updating packages

WaseemAhmadNaeem avatar Nov 21 '18 08:11 WaseemAhmadNaeem

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.