Question T2706
Visible to All Users

surveyjs_angular_cli repo doesn't work

created 6 years ago

I'm fairly new to Angular so apologies in advance if I'm missing something basic. I've downloaded the Angular 7 CLI project from https://github.com/surveyjs/surveyjs_angular_cli and then run npm i which completed but with the following error:

npm ERR! cb() never called!

npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! https://npm.community

Running ng serve then gave the following error:

An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "C:\Dev\surveyjs_angular_cli-master".
See "…\angular-errors.log" for further details. This is the total contents of the related the log file:

[error] Error: Could not find module "@angular-devkit/build-angular" from "C:\Dev\surveyjs_angular_cli-master".
at Object.resolve (C:\Users\gstott1\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\core\node\resolve.js:151:11)
at WorkspaceNodeModulesArchitectHost.resolveBuilder (C:\Users\gstott1\AppData\Roaming\npm\node_modules@angular\cli\node_modules@angular-devkit\architect\node\node-modules-architect-host.js:31:40)
at ServeCommand.initialize (C:\Users\gstott1\AppData\Roaming\npm\node_modules@angular\cli\models\architect-command.js:134:55)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:834:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)

I then tried npm install --save-dev @angular-devkit/build-angular but this generated this error:

npm ERR! path git
npm ERR! code ENOENT
npm ERR! errno ENOENT
npm ERR! syscall spawn git
npm ERR! enoent Error while executing:
npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git
npm ERR! enoent
npm ERR! enoent
npm ERR! enoent spawn git ENOENT
npm ERR! enoent This is related to npm not being able to find a file.
npm ERR! enoent

And running ng serve still generates the error:

An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "C:\Dev\surveyjs_angular_cli-master".

We're trying to evaluate your great looking product for potential integration into our work and asset management enterprise product so any help would be greatly appreciated.

Thanks.

Comments (3)

    Hello,

    I've just cloned the surveyjs_angular_cli repo, run the npm i command and then npm start.
    I havn't got any errors during npm i command executing.
    I've got two errors during compilation. I've fixed them via the https://github.com/surveyjs/surveyjs_angular_cli/commit/4c8823bc069288b6211687bb9bc99ff427d3966b and https://github.com/surveyjs/surveyjs_angular_cli/commit/b4609a4d7a583696026fdbadeca830b38444655c commits.

    Could you try to get my last changed from GitHub, remove the node_modules and try to install node modules again?

    Thanks, Serge
    SurveyJS Team

      Thanks for your quick response Serge. I've installed GitHub desktop, cloned the project (with your changes) to a new folder, there was no node_modules folder to delete so I just opened the base folder in Visual Studio Code, ran **npm i ** which gave the same error as before. I then ran **ng serve ** and got the same error as before.

      I've previously tried the other method that you detail to create the project by creating a new local project using the Angular CLI and completing the other various changes. I needed several other additional changes (which I can send you if you're interested) but eventually got the project working although there are still some JavaScript errors that seems to prevent the app from functioning 100% correctly:

      ERROR TypeError: Unable to process binding "template: function(){return { name:'objecteditorproperty',afterRender:$parent.koAfterRender} }"
      Message: Unable to process binding "template: function(){return { name:'propertyeditor-'+ editorTypeTemplate,data:$data.editor} }"
      Message: Unable to process binding "template: function(){return { name:'propertyeditor-modal',data:$data} }"
      Message: Unable to process binding "template: function(){return { name:'propertyeditor-modalcontent',data:$data} }"
      Message: Unable to process binding "template: function(){return { name:'propertyeditorcontent-'+ editorTypeTemplate,data:$data,afterRender:$data.koAfterRender} }"
      Message: Cannot read property 'replace' of undefined
      at Object.afterRender (:4200/main.js:537)
      at SurveyPropertyModalEditorCustomWidget.afterRender (:4200/vendor.js:160546)
      at SurveyPropertyHtmlEditor.SurveyPropertyModalEditor.afterRender (:4200/vendor.js:160690)
      at SurveyPropertyModalEditor.self.koAfterRender (:4200/vendor.js:160617)
      at Object.K (:4200/vendor.js:100402)
      at e (:4200/vendor.js:100486)
      at a.$.Sa (:4200/vendor.js:100487)
      at Function.xd (:4200/vendor.js:100416)
      at Function.yd (:4200/vendor.js:100416)
      at Function.ha (:4200/vendor.js:100415)
      defaultErrorLogger @ :4200/vendor.js:40770
      2:4200/vendor.js:40770 ERROR TypeError: Cannot read property 'length' of undefined
      at Object.Ua (:4200/vendor.js:100375)
      at a.a.cc (:4200/vendor.js:100495)
      at Object.K (:4200/vendor.js:100402)
      at y (:4200/vendor.js:100487)
      at a.gc.kc (:4200/vendor.js:100489)
      at Function.notifySubscribers (:4200/vendor.js:100399)
      at Function.b.notifySubscribers (:4200/vendor.js:100409)
      at a.gc.c [as kc] (:4200/vendor.js:100409)
      at Function.notifySubscribers (:4200/vendor.js:100399)
      at Function.b.notifySubscribers (:4200/vendor.js:100409)

      This is the line (:4200/main.js:537) that seems to be causing the problems:

      var editor = window["CKEDITOR"].replace(htmlElement);

      Thanks.

        Hello,

        Could you try to run "npm start" instead of "ng serve" from command line? First command starts ng from the local application node modules while the second command runs your global installed angular package.

        As for the runtime error - probably the "ckeditor" package is not loaded. It doesn't affect SurveyJS libraries functionality. If you provide us with steps to reproduce this error, we'll fix it.

        Thanks, Serge
        SurveyJS Team

        Answers

        created 6 years ago

        It would appear that all the above was possibly caused by an incomplete/broken install of my global Angular CLI. I don't know this for sure but I recently updated my install, re-tried the Survey JS repo and it now works ok. I therefore consider this ticket closed. Thanks for your assistance.

          Comments (1)

            Thank you for the info!
            Glad to hear that issue has been resolved.
            You are always welcome!

            Thanks, Serge
            SurveyJS Team

            created 6 years ago

            Hi Serge,

            Thanks. I'd come across the Stackoverflow thread and tried the various suggestions before with no luck. I've also just tried the other fix and after running the uninstall command I completed the other steps with the results below:

            npm i --save-dev @angular-devkit/build-angular@latest
            npm ERR! path git
            npm ERR! code ENOENT
            npm ERR! errno ENOENT
            npm ERR! syscall spawn git
            npm ERR! enoent Error while executing:
            npm ERR! enoent undefined ls-remote -h -t ssh://git@github.com/eligrey/FileSaver.js.git
            npm ERR! enoent
            npm ERR! enoent
            npm ERR! enoent spawn git ENOENT
            npm ERR! enoent This is related to npm not being able to find a file.
            npm ERR! enoent

            npm ERR! A complete log of this run can be found in:
            npm ERR! C:\Users\gstott1\AppData\Roaming\npm-cache_logs\2019-09-25T15_08_49_888Z-debug.log
            PS C:\Dev\GitHub\surveyjs_angular_cli> ng update
            Using package manager: 'npm'
            Collecting installed dependencies…
            Found 44 dependencies.
            An unexpected error happened; could not determine version for package survey-angular.
            PS C:\Dev\GitHub\surveyjs_angular_cli> node -v
            v10.16.2
            PS C:\Dev\GitHub\surveyjs_angular_cli> npm -v
            6.9.0

            Running npm start still gives the same error:

            An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "C:\Dev\GitHub\surveyjs_angular_cli".

              Comments (1)

                Hello,

                To be honest, I'm not much of an Angular programmer. I believe the issue is not related to the SurveyJS library, but to the specific environment.
                I've not managed to reproduce the issue locally and hence can't give any advices how to fix it. Probably angular forums can give some light here.

                Thanks, Serge
                SurveyJS Team

                created 6 years ago

                Hi Serge,

                Running "npm start" gives the following error:

                npm start

                surveyjs-angular-cli@1.1.0 start C:\Dev\GitHub\surveyjs_angular_cli
                ng serve

                An unhandled exception occurred: Could not find module "@angular-devkit/build-angular" from "C:\Dev\GitHub\surveyjs_angular_cli".
                See "C:\Users\gstott1\AppData\Local\Temp\ng-5kqt7B\angular-errors.log" for further details.
                npm ERR! file C:\WINDOWS\system32\cmd.exe
                npm ERR! code ELIFECYCLE
                npm ERR! errno ENOENT
                npm ERR! syscall spawn
                npm ERR! surveyjs-angular-cli@1.1.0 start: ng serve
                npm ERR! spawn ENOENT
                npm ERR!
                npm ERR! Failed at the surveyjs-angular-cli@1.1.0 start 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! C:\Users\gstott1\AppData\Roaming\npm-cache_logs\2019-09-24T13_01_25_014Z-debug.log

                Below is the content of the debug.log file:

                0 info it worked if it ends with ok
                1 verbose cli [ 'C:\Program Files\nodejs\node.exe',
                1 verbose cli 'C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js',
                1 verbose cli 'start' ]
                2 info using npm@6.9.0
                3 info using node@v10.16.2
                4 verbose run-script [ 'prestart', 'start', 'poststart' ]
                5 info lifecycle surveyjs-angular-cli@1.1.0~prestart: surveyjs-angular-cli@1.1.0
                6 info lifecycle surveyjs-angular-cli@1.1.0~start: surveyjs-angular-cli@1.1.0
                7 verbose lifecycle surveyjs-angular-cli@1.1.0~start: unsafe-perm in lifecycle true
                8 verbose lifecycle surveyjs-angular-cli@1.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\Dev\GitHub\surveyjs_angular_cli\node_modules.bin;C:\WINDOWS\system32;C:\WINDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\System32\WindowsPowerShell\v1.0;C:\WINDOWS\System32\OpenSSH;C:\Program Files (x86)\Enterprise Vault\EVClient\x64;C:\Program Files\Microsoft SQL Server\Client SDK\ODBC\110\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn\ManagementStudio;C:\Program Files (x86)\Microsoft SQL Server\120\Tools\Binn;C:\Program Files\Microsoft SQL Server\120\Tools\Binn;C:\Program Files (x86)\Microsoft SQL Server\120\DTS\Binn;C:\Program Files\nodejs;C:\Users\gstott1\AppData\Local\Microsoft\WindowsApps;;C:\Users\gstott1\AppData\Local\Programs\Microsoft VS Code\bin;C:\Users\gstott1\AppData\Roaming\npm
                9 verbose lifecycle surveyjs-angular-cli@1.1.0~start: CWD: C:\Dev\GitHub\surveyjs_angular_cli
                10 silly lifecycle surveyjs-angular-cli@1.1.0~start: Args: [ '/d /s /c', 'ng serve' ]
                11 info lifecycle surveyjs-angular-cli@1.1.0~start: Failed to exec start script
                12 verbose stack Error: surveyjs-angular-cli@1.1.0 start: ng serve
                12 verbose stack spawn ENOENT
                12 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:48:18)
                12 verbose stack at ChildProcess.emit (events.js:198:13)
                12 verbose stack at maybeClose (internal/child_process.js:982:16)
                12 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:259:5)
                13 verbose pkgid surveyjs-angular-cli@1.1.0
                14 verbose cwd C:\Dev\GitHub\surveyjs_angular_cli
                15 verbose Windows_NT 10.0.17134
                16 verbose argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
                17 verbose node v10.16.2
                18 verbose npm v6.9.0
                19 error file C:\WINDOWS\system32\cmd.exe
                20 error code ELIFECYCLE
                21 error errno ENOENT
                22 error syscall spawn
                23 error surveyjs-angular-cli@1.1.0 start: ng serve
                23 error spawn ENOENT
                24 error Failed at the surveyjs-angular-cli@1.1.0 start script.
                24 error This is probably not a problem with npm. There is likely additional logging output above.
                25 verbose exit [ 1, true ]

                  Comments (1)

                    Hello,

                    Unfortunately I've not managed to reproduce the issue locally.

                    I've googled the "An unhandled exception occurred: Could not find module "@angular-devkit/build-angular"" error text and found some related threads:
                    https://stackoverflow.com/questions/50333003/could-not-find-module-angular-devkit-build-angular
                    https://thecodebuzz.com/resolved-could-not-find-the-implementation-for-builder-angular-devkit-build-angularbrowser/
                    Can you check the suggestions from where?

                    Thanks, Serge
                    SurveyJS Team