4
respostas

Erro na preparação do ambiente.

sudo apt-get install -y nodejs
Reading package lists... Done
Building dependency tree       
Reading state information... Done
nodejs is already the newest version (10.19.0~dfsg-3ubuntu1).
0 to upgrade, 0 to newly install, 0 to remove and 0 not to upgrade.

-

sudo ln -s /usr/bin/nodejs /usr/bin/node
ln: failed to create symbolic link '/usr/bin/node': File exists

-

npm start
npm ERR! missing script: start

npm ERR! A complete log of this run can be found in:
npm ERR!     /home/fredo/.npm/_logs/2021-04-07T17_44_46_247Z-debug.log

-

2021-04-07T17_44_46_247Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'start' ]
2 info using npm@6.14.4
3 info using node@v10.19.0
4 verbose stack Error: missing script: start
4 verbose stack     at run (/usr/share/npm/lib/run-script.js:155:19)
4 verbose stack     at /usr/share/npm/lib/run-script.js:63:5
4 verbose stack     at /usr/share/nodejs/read-package-json/read-json.js:116:5
4 verbose stack     at /usr/share/nodejs/read-package-json/read-json.js:436:5
4 verbose stack     at checkBinReferences_ (/usr/share/nodejs/read-package-json/read-json.js:391:45)
4 verbose stack     at final (/usr/share/nodejs/read-package-json/read-json.js:434:3)
4 verbose stack     at then (/usr/share/nodejs/read-package-json/read-json.js:161:5)
4 verbose stack     at /usr/share/nodejs/read-package-json/read-json.js:281:12
4 verbose stack     at /usr/share/nodejs/graceful-fs/graceful-fs.js:115:16
4 verbose stack     at FSReqWrap.readFileAfterClose [as oncomplete] (internal/fs/read_file_context.js:53:3)
5 verbose cwd /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master
6 verbose Linux 5.8.0-48-generic
7 verbose argv "/usr/bin/node" "/usr/bin/npm" "start"
8 verbose node v10.19.0
9 verbose npm  v6.14.4
10 error missing script: start
11 verbose exit [ 1, true ]

-

npm install
> yorkie@2.0.0 install /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master/node_modules/yorkie
> node bin/install.js

setting up Git hooks
can't find .git directory, skipping Git hooks installation

> core-js@2.6.11 postinstall /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master/node_modules/babel-runtime/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"

Thank you for using core-js ( https://github.com/zloirock/core-js ) for polyfilling JavaScript standard library!

The project needs your help! Please consider supporting of core-js on Open Collective or Patreon: 
> https://opencollective.com/core-js 
> https://www.patreon.com/zloirock 

Also, the author of core-js ( https://github.com/zloirock ) is looking for a good job -)


> core-js@3.6.5 postinstall /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master/node_modules/core-js
> node -e "try{require('./postinstall')}catch(e){}"


> core-js-pure@3.6.5 postinstall /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master/node_modules/core-js-pure
> node -e "try{require('./postinstall')}catch(e){}"


> ejs@2.7.4 postinstall /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master/node_modules/ejs
> node ./postinstall.js

Thank you for installing EJS: built with the Jake JavaScript build tool (https://jakejs.com/)

npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/webpack-dev-server/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

added 1598 packages from 1073 contributors and audited 1602 packages in 17.815s

54 packages are looking for funding
  run `npm fund` for details

found 4730 vulnerabilities (4686 low, 8 moderate, 36 high)
  run `npm audit fix` to fix them, or `npm audit` for details

-

4 respostas
npm audit fix
npm WARN deprecated chokidar@2.1.8: Chokidar 2 will break on node v14+. Upgrade to chokidar 3 with 15x less dependencies.
npm WARN deprecated fsevents@1.2.13: fsevents 1 will break on node v14+ and could be using insecure binaries. Upgrade to fsevents 2.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@^1.2.7 (node_modules/webpack-dev-server/node_modules/chokidar/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@2.1.3 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@2.1.3: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/jest-haste-map/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.13 (node_modules/watchpack-chokidar2/node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.13: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

+ axios@0.21.1
added 9 packages from 23 contributors, removed 10 packages, updated 9 packages and moved 1 package in 14.927s

54 packages are looking for funding
  run `npm fund` for details

fixed 4725 of 4730 vulnerabilities in 1602 scanned packages
  5 vulnerabilities

 required manual review and could not be updated

-

npm run serve
> testing@0.1.0 serve /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master
> vue-cli-service serve

sh: 1: vue-cli-service: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! testing@0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the testing@0.1.0 serve 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!     /home/fredo/.npm/_logs/2021-04-07T17_53_02_028Z-debug.log

-

2021-04-07T17_53_02_028Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'run', 'serve' ]
2 info using npm@6.14.4
3 info using node@v10.19.0
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle testing@0.1.0~preserve: testing@0.1.0
6 info lifecycle testing@0.1.0~serve: testing@0.1.0
7 verbose lifecycle testing@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle testing@0.1.0~serve: PATH: /usr/share/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master/node_modules/.bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/fredo/.dotnet/tools
9 verbose lifecycle testing@0.1.0~serve: CWD: /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master
10 silly lifecycle testing@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 info lifecycle testing@0.1.0~serve: Failed to exec serve script
12 verbose stack Error: testing@0.1.0 serve: `vue-cli-service serve`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/usr/share/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 testing@0.1.0
14 verbose cwd /home/fredo/Development/Javascript/Vue.js: Testes unitários automatizados com Jest/vue-test-master
15 verbose Linux 5.8.0-48-generic
16 verbose argv "/usr/bin/node" "/usr/bin/npm" "run" "serve"
17 verbose node v10.19.0
18 verbose npm  v6.14.4
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error testing@0.1.0 serve: `vue-cli-service serve`
23 error spawn ENOENT
24 error Failed at the testing@0.1.0 serve script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Olá, Frederico!

Vamos tentar novamente?

Baixe novamente o projeto inicial aqui num local diferente. Após descompactar o projeto, vamos pedir ao npm para instalar as dependências:

npm install

e em seguida:

npm run serve

Pude perceber que por algum motivo a versão do node que está instalada é a 10.19. Caso o problema persista, você pode usar o nvm para configurar a versão mais recente do node (a versão LTS mais recente, na data que respondo, é a 14.16.1) e então refazer esses passos.

Olá, Mesmo após atualização da versão do node erro persiste:

node --version
v14.16.1

-

npm install
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.11 (node_modules/fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.11: wanted {"os":"darwin","arch":"any"} (current: {"os":"linux","arch":"x64"})

audited 1284 packages in 12.373s

39 packages are looking for funding
  run `npm fund` for details

found 298 vulnerabilities (272 low, 7 moderate, 19 high)
  run `npm audit fix` to fix them, or `npm audit` for details

-

npm run serve
> projeto@0.1.0 serve /home/fredo/Development/Javascript/Alura/Vue.js: Testes unitários automatizados com Jest/auth-vue-vuex-48dd3dd2848ff6df4ed6dca43fa9dee1361b46db
> vue-cli-service serve

sh: 1: vue-cli-service: not found
npm ERR! code ELIFECYCLE
npm ERR! syscall spawn
npm ERR! file sh
npm ERR! errno ENOENT
npm ERR! projeto@0.1.0 serve: `vue-cli-service serve`
npm ERR! spawn ENOENT
npm ERR! 
npm ERR! Failed at the projeto@0.1.0 serve 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!     /home/fredo/.npm/_logs/2021-04-11T19_50_33_896Z-debug.log

-

 /home/fredo/.npm/_logs/2021-04-11T19_50_33_896Z-debug.log
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli   '/home/fredo/.nvm/versions/node/v14.16.1/bin/node',
1 verbose cli   '/home/fredo/.nvm/versions/node/v14.16.1/bin/npm',
1 verbose cli   'run',
1 verbose cli   'serve'
1 verbose cli ]
2 info using npm@6.14.12
3 info using node@v14.16.1
4 verbose run-script [ 'preserve', 'serve', 'postserve' ]
5 info lifecycle projeto@0.1.0~preserve: projeto@0.1.0
6 info lifecycle projeto@0.1.0~serve: projeto@0.1.0
7 verbose lifecycle projeto@0.1.0~serve: unsafe-perm in lifecycle true
8 verbose lifecycle projeto@0.1.0~serve: PATH: /home/fredo/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/node-gyp-bin:/home/fredo/Development/Javascript/Alura/Vue.js: Testes unitários automatizados com Jest/auth-vue-vuex-48dd3dd2848ff6df4ed6dca43fa9dee1361b46db/node_modules/.bin:/home/fredo/.nvm/versions/node/v14.16.1/bin:/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games:/snap/bin:/home/fredo/.dotnet/tools
9 verbose lifecycle projeto@0.1.0~serve: CWD: /home/fredo/Development/Javascript/Alura/Vue.js: Testes unitários automatizados com Jest/auth-vue-vuex-48dd3dd2848ff6df4ed6dca43fa9dee1361b46db
10 silly lifecycle projeto@0.1.0~serve: Args: [ '-c', 'vue-cli-service serve' ]
11 info lifecycle projeto@0.1.0~serve: Failed to exec serve script
12 verbose stack Error: projeto@0.1.0 serve: `vue-cli-service serve`
12 verbose stack spawn ENOENT
12 verbose stack     at ChildProcess.<anonymous> (/home/fredo/.nvm/versions/node/v14.16.1/lib/node_modules/npm/node_modules/npm-lifecycle/lib/spawn.js:48:18)
12 verbose stack     at ChildProcess.emit (events.js:315:20)
12 verbose stack     at maybeClose (internal/child_process.js:1048:16)
12 verbose stack     at Process.ChildProcess._handle.onexit (internal/child_process.js:288:5)
13 verbose pkgid projeto@0.1.0
14 verbose cwd /home/fredo/Development/Javascript/Alura/Vue.js: Testes unitários automatizados com Jest/auth-vue-vuex-48dd3dd2848ff6df4ed6dca43fa9dee1361b46db
15 verbose Linux 5.8.0-48-generic
16 verbose argv "/home/fredo/.nvm/versions/node/v14.16.1/bin/node" "/home/fredo/.nvm/versions/node/v14.16.1/bin/npm" "run" "serve"
17 verbose node v14.16.1
18 verbose npm  v6.14.12
19 error code ELIFECYCLE
20 error syscall spawn
21 error file sh
22 error errno ENOENT
23 error projeto@0.1.0 serve: `vue-cli-service serve`
23 error spawn ENOENT
24 error Failed at the projeto@0.1.0 serve script.
24 error This is probably not a problem with npm. There is likely additional logging output above.
25 verbose exit [ 1, true ]

Frederico, pode confirmar pra mim a versão do seu Ubunto?

O erro que vc compartilhou é que o vue-cli-service não foi encontrado. Pode verificar tb se ele existe na pasta node_modules/@vue/cli-service ?

Quer mergulhar em tecnologia e aprendizagem?

Receba a newsletter que o nosso CEO escreve pessoalmente, com insights do mercado de trabalho, ciência e desenvolvimento de software