Olá,
Mais um dúvida. Meu npm run start não roda. Dá esse erro:
[0] Error occurred when executing command: npm run watch
[0] Error: spawn cmd.exe ENOENT
[0] at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
[0] at onErrorNT (node:internal/child_process:478:16)
[0] at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1] Error occurred when executing command: npm run server
[1] Error: spawn cmd.exe ENOENT
[1] at Process.ChildProcess._handle.onexit (node:internal/child_process:283:19)
[1] at onErrorNT (node:internal/child_process:478:16)
[1] at processTicksAndRejections (node:internal/process/task_queues:83:21)
[1] npm run server exited with code -4058
[0] npm run watch exited with code -4058
npm run watch e npm run server funcionam.
npm run server na verdade preciso clicar no link, só digitando igual ao professor faz, não funciona:
PC - GIOVANNA@GIOVANA MINGW64 ~/Desktop/TypeScript/typescript-curso-1-arquivos-iniciais (main)
$ npm run server
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
> alurabank@1.0.0 server
> lite-server --baseDir=dist
Did not detect a `bs-config.json` or `bs-config.js` override file. Using lite-server defaults...
** browser-sync config **
{
injectChanges: false,
files: [ './**/*.{html,htm,css,js}' ],
watchOptions: { ignored: 'node_modules' },
server: {
baseDir: 'dist',
middleware: [ [Function (anonymous)], [Function (anonymous)] ]
}
}
[Browsersync] Access URLs:
--------------------------------------
Local: http://localhost:3000
External: http://192.168.1.104:3000
--------------------------------------
UI: http://localhost:3001
UI External: http://localhost:3001
--------------------------------------
[Browsersync] Serving files from: dist
[Browsersync] Watching files...
[Browsersync] Couldn't open browser (if you are using BrowserSync in a headless environment, you might want to set the open option to false)
Quando tento rodar o npm run start dá erro.
package.json:
{
"name": "alurabank",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1",
"server": "lite-server --baseDir=dist",
"start": "concurrently \"npm run watch\" \"npm run server\"",
"compile": "tsc",
"watch": "tsc -w"
},
"author": "",
"license": "ISC",
"devDependencies": {
"concurrently": "^6.0.0",
"lite-server": "^2.6.1",
"typescript": "^4.2.2"
}
}
tsconfig.json:
{
"compilerOptions": {
"outDir": "dist/js",
"target": "ES6",
"noEmitOnError": true
},
"include": ["app/**/*"]
}