vuejs / vue-cli

šŸ› ļø webpack-based tooling for Vue.js Development
https://cli.vuejs.org/
MIT License
29.76k stars 6.33k forks source link

TypeError: Cannot read property 'indexOf' of undefined #4694

Closed yuexing0921 closed 5 years ago

yuexing0921 commented 5 years ago

Version

4.0.2

Environment info

Environment Info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 77.0.3865.120
    Firefox: 68.0.1
    Safari: 13.0.2
  npmPackages:
    @vue/babel-preset-app:  3.1.1
    @vue/cli-overlay:  3.9.0
    @vue/cli-plugin-babel: ^3.1.0 => 3.1.1
    @vue/cli-plugin-eslint: ^3.1.0 => 3.11.0
    @vue/cli-service: ^3.8.0 => 3.9.2
    @vue/cli-shared-utils:  3.9.0 (3.11.0)
    @vue/component-compiler-utils:  2.6.0
    @vue/eslint-config-standard:  4.0.0
    @vue/eslint-config-typescript:  4.0.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    babel-helper-vue-jsx-merge-props:  2.0.3
    babel-plugin-transform-vue-jsx:  4.0.1
    eslint-plugin-vue:  5.0.0-beta.5 (4.7.1)
    typescript: ~3.2.4 => 3.2.4 (3.5.3, 3.6.3, 2.5.3)
    vue: ^2.5.17 => 2.6.10
    vue-amap: ^0.5.10 => 0.5.10
    vue-class-component: ^6.0.0 => 6.3.2
    vue-cli-plugin-typescript: ^0.0.1 => 0.0.1
    vue-eslint-parser:  3.3.0 (2.0.3)
    vue-gen-router: ^0.0.5 => 0.0.5
    vue-hot-reload-api:  2.3.1
    vue-loader:  15.7.0
    vue-property-decorator: ^7.0.0 => 7.3.0
    vue-router: ^3.0.1 => 3.0.2
    vue-simple-uploader: ^0.6.0 => 0.6.0
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.17 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuedraggable: ^2.17.0 => 2.17.0
    vuex: ^3.0.1 => 3.0.1
  npmGlobalPackages:
    @vue/cli: 4.0.2

Steps to reproduce

npm install -g @vue/cli

vue ui

http://localhost:8000/project/create Details => Project folder => vue-cli-4.0 Presets => vue-ts => TypeError: Cannot read property 'indexOf' of undefined

What is expected?

Normally generated project

What is actually happening?

Unable to generate, always stuck there


Installing CLI plugins. This might take a while...

šŸš€ Invoking generators... šŸ“¦ Installing additional dependencies...

at makeError (/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)

code: 1, stdout: 'āš™ Installing CLI plugins. This might take a while...\n\nšŸš€ Invoking generators...\nšŸ“¦ Installing additional dependencies...\n\n', stderr: null, failed: true, signal: null, cmd: 'vue create vue-cli-4.0 --skipGetStarted --packageManager yarn --inlinePreset {"useConfigFiles":false,"plugins":{"@vue/cli-plugin-babel":{},"@vue/cli-plugin-typescript":{"classComponent":true,"useTsWithBabel":true},"@vue/cli-plugin-eslint":{"config":"prettier","lintOn":["save","commit"]}},"router":true,"routerHistoryMode":false,"vuex":true}', timedOut: false, killed: false } TypeError: Cannot read property 'indexOf' of undefined at progress.wrap (/usr/local/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apollo-server/connectors/projects.js:274:35) at process._tickCallback (internal/process/next_tick.js:68:7) TypeError: Cannot read property 'indexOf' of undefined at progress.wrap (/usr/local/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apollo-server/connectors/projects.js:274:35) at process._tickCallback (internal/process/next_tick.js:68:7)

image

TimurGumarov commented 4 years ago

@yuexing0921 Hello! I think that because of invalid project name. In some case vue ui doesn't validate the name right. I've reporoduced this issue vith project name "!_VUE-start". vue ui passed this through, but vue cli said me that this project name is invalid.

ck-chenkang commented 4 years ago

use command line vue create myproject, no problem

aminehck commented 4 years ago

use CamelCase name for the project and don't use - or _

Firat-Bayram commented 4 years ago

i try CamelCase proje name but the error continue.

ProjectCreate.vue:659 Error: GraphQL error: Cannot return null for non-nullable field Mutation.projectCreate. at new t (bundle.esm.js:63) at Object.next (bundle.esm.js:1004) at g (Observable.js:135) at x (Observable.js:179) at e.value (Observable.js:235) at bundle.esm.js:866 at Set.forEach () at Object.next (bundle.esm.js:866) at Object.handler (client.js:145) at e.processReceivedData (client.js:512)

Firat-Bayram commented 4 years ago

on windows computers caused by wrong prefix path. I changed prefix to "C:\Users\Administrator\AppData\Roaming\npm" and the error has been fixed.

nonso07 commented 4 years ago

I have the same issue @Firat-Bayram what do you mean by changing prefix path

tennessine commented 4 years ago

In my case , I didn't install yarn, when I use 'vue create projectName' in command line and it will give me the specified error.

Firat-Bayram commented 4 years ago

npm prefix -g =>my global path C:\Users\\AppData\Roaming\npm

if your path is different , you can change it with the command below

npm config set prefix $value

nianxiongdi commented 4 years ago

Version

4.0.2

Environment info

Environment Info:

  System:
    OS: macOS Mojave 10.14.6
    CPU: (12) x64 Intel(R) Core(TM) i7-8750H CPU @ 2.20GHz
  Binaries:
    Node: 10.16.0 - /usr/local/bin/node
    Yarn: 1.16.0 - /usr/local/bin/yarn
    npm: 6.11.3 - /usr/local/bin/npm
  Browsers:
    Chrome: 77.0.3865.120
    Firefox: 68.0.1
    Safari: 13.0.2
  npmPackages:
    @vue/babel-preset-app:  3.1.1
    @vue/cli-overlay:  3.9.0
    @vue/cli-plugin-babel: ^3.1.0 => 3.1.1
    @vue/cli-plugin-eslint: ^3.1.0 => 3.11.0
    @vue/cli-service: ^3.8.0 => 3.9.2
    @vue/cli-shared-utils:  3.9.0 (3.11.0)
    @vue/component-compiler-utils:  2.6.0
    @vue/eslint-config-standard:  4.0.0
    @vue/eslint-config-typescript:  4.0.0
    @vue/preload-webpack-plugin:  1.1.0
    @vue/web-component-wrapper:  1.2.0
    babel-helper-vue-jsx-merge-props:  2.0.3
    babel-plugin-transform-vue-jsx:  4.0.1
    eslint-plugin-vue:  5.0.0-beta.5 (4.7.1)
    typescript: ~3.2.4 => 3.2.4 (3.5.3, 3.6.3, 2.5.3)
    vue: ^2.5.17 => 2.6.10
    vue-amap: ^0.5.10 => 0.5.10
    vue-class-component: ^6.0.0 => 6.3.2
    vue-cli-plugin-typescript: ^0.0.1 => 0.0.1
    vue-eslint-parser:  3.3.0 (2.0.3)
    vue-gen-router: ^0.0.5 => 0.0.5
    vue-hot-reload-api:  2.3.1
    vue-loader:  15.7.0
    vue-property-decorator: ^7.0.0 => 7.3.0
    vue-router: ^3.0.1 => 3.0.2
    vue-simple-uploader: ^0.6.0 => 0.6.0
    vue-style-loader:  4.1.2
    vue-template-compiler: ^2.5.17 => 2.6.10
    vue-template-es2015-compiler:  1.9.1
    vuedraggable: ^2.17.0 => 2.17.0
    vuex: ^3.0.1 => 3.0.1
  npmGlobalPackages:
    @vue/cli: 4.0.2

Steps to reproduce

npm install -g @vue/cli

vue ui

http://localhost:8000/project/create Details => Project folder => vue-cli-4.0 Presets => vue-ts => TypeError: Cannot read property 'indexOf' of undefined

What is expected?

Normally generated project

What is actually happening?

Unable to generate, always stuck there

Installing CLI plugins. This might take a while...

Invoking generators... Installing additional dependencies...

at makeError (/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:174:9)
at Promise.all.then.arr (/usr/local/lib/node_modules/@vue/cli/node_modules/execa/index.js:278:16)
at process._tickCallback (internal/process/next_tick.js:68:7)

code: 1, stdout: ' Installing CLI plugins. This might take a while...\n\n Invoking generators...\n Installing additional dependencies...\n\n', stderr: null, failed: true, signal: null, cmd: 'vue create vue-cli-4.0 --skipGetStarted --packageManager yarn --inlinePreset {"useConfigFiles":false,"plugins":{"@vue/cli-plugin-babel":{},"@vue/cli-plugin-typescript":{"classComponent":true,"useTsWithBabel":true},"@vue/cli-plugin-eslint":{"config":"prettier","lintOn":["save","commit"]}},"router":true,"routerHistoryMode":false,"vuex":true}', timedOut: false, killed: false } TypeError: Cannot read property 'indexOf' of undefined at progress.wrap (/usr/local/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apollo-server/connectors/projects.js:274:35) at process._tickCallback (internal/process/next_tick.js:68:7) TypeError: Cannot read property 'indexOf' of undefined at progress.wrap (/usr/local/lib/node_modules/@vue/cli/node_modules/@vue/cli-ui/apollo-server/connectors/projects.js:274:35) at process._tickCallback (internal/process/next_tick.js:68:7)

image

this problem. i think is node version. please change node version.

martinsirka commented 3 years ago

Tried every solution I found here or StackOverflow nothing worked for me. Found out that if I use Sass/SCSS (with node-sass) it will crush but if I use Sass/SCSS (with dart-sass) it will create a project as expected. image

thelv commented 1 year ago

Tried every solution I found here or StackOverflow nothing worked for me. Found out that if I use Sass/SCSS (with node-sass) it will crush but if I use Sass/SCSS (with dart-sass) it will create a project as expected. image

I have the same issue. On what page you can choose Sass/SCSS (with dart-sass) ?