0
Good evening! I have this problem. I have tried some things I found on the net but nothing has worked so far. npm is installed ([email protected] C: Program Files nodejs node_modules npm) and PATH (C: Program Files nodejs). Please help me:
$ npm run dev
> @ dev C:\xampp\htdocs\lsapp
> npm run development
'npm' não é reconhecido como um comando interno
ou externo, um programa operável ou um arquivo em lotes.
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! @ dev: `npm run development`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the @ dev script.
npm ERR! This is probably not a problem with npm. There is likely additional logging output above.
Below is the error log:
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 'run',
1 verbose cli 'dev' ]
2 info using [email protected]
3 info using [email protected]
4 verbose run-script [ 'predev', 'dev', 'postdev' ]
5 info lifecycle @~predev: @
6 info lifecycle @~dev: @
7 verbose lifecycle @~dev: unsafe-perm in lifecycle true
8 verbose lifecycle @~dev: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;C:\xampp\htdocs\lsapp\node_modules\.bin;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Users\Jeferson\bin;C:\Python27;C:\Python27\Scripts;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Common Files\Oracle\Java\javapat;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files (x86)\MySQ";C:\Program Files (x86)\Common Files\Oracle\Java\javapat;C:\ProgramData\Oracle\Java\javapath;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0;C:\Windows\System32\OpenSSH;C:\Program Files\Java\jdk1.8.0_202\bin;.;C:\xampp\php;C:\ProgramData\ComposerSetup\bin;C:\Program Files\Git\cmd;C:\Program Files\Git\mingw64\bin;C:\Program Files\Git\usr\bin;C:\Program Files\Microsoft VS Code\bin;C:\Program Files\nodejs;C:\ProgramData\chocolatey\bin;C:\Users\Jeferson\AppData\Local\Microsoft\WindowsApps;C:\Users\Jeferson\AppData\Roaming\Composer\vendor\bin;C:\Users\Jeferson\AppData\Roaming\npm;C:\Program Files\nodejs
9 verbose lifecycle @~dev: CWD: C:\xampp\htdocs\lsapp
10 silly lifecycle @~dev: Args: [ '/d /s /c', 'npm run development' ]
11 silly lifecycle @~dev: Returned: code: 1 signal: null
12 info lifecycle @~dev: Failed to exec dev script
13 verbose stack Error: @ dev: `npm run development`
13 verbose stack Exit status 1
13 verbose stack at EventEmitter.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\index.js:301:16)
13 verbose stack at EventEmitter.emit (events.js:197:13)
13 verbose stack at ChildProcess.<anonymous> (C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\lib\spawn.js:55:14)
13 verbose stack at ChildProcess.emit (events.js:197:13)
13 verbose stack at maybeClose (internal/child_process.js:984:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:265:5)
14 verbose pkgid @
15 verbose cwd C:\xampp\htdocs\lsapp
16 verbose Windows_NT 10.0.17134
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "run" "dev"
18 verbose node v11.10.0
19 verbose npm v6.7.0
20 error code ELIFECYCLE
21 error errno 1
22 error @ dev: `npm run development`
22 error Exit status 1
23 error Failed at the @ dev script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
Did you install NPM? If so, make sure to add to Windows PATH?
– João Pedro Henrique
what are you doing, typing npm in the terminal?
– Erick Luz
Hello! I changed the post with the information. Thank you for your attention!
– Jeferson Ferreira
The error in question is somewhat incoherent, since it is first said that
npm
is not recognized as a command, but then shows some logs NPM error message. Are you sure that’s the correct error message you get?– Luiz Felipe
I agree with you that it is strange, but this is the return I have. If I just type 'npm' it shows me the options. If I type 'npm -v' it gives me the return '6.7.0'. If I type 'npm run' it shows me the options, but finally if I type 'npm run dev' it returns me the error above. I will edit the question and add the error log to see if it helps. Thanks for your attention!
– Jeferson Ferreira
I think you’re calling
nmp
ofbash
or ofpowershell
. Flame of the prompt ofDOS
or else enter (both bash and powershell) with the commandCMD.exe
opening a DOS prompt, do your job withnmp
and useexit
to get out ofDOS
.– Augusto Vasques
@Augustovasques Very grateful! That way it works!!! I just don’t understand yet why the bash of VS Code doesn’t work :(... But at least now I can continue my studies! Thanks!
– Jeferson Ferreira
@Jefersonferreira. Because both the bash and the
powershell
do not give conventional support to environment variables. Thepowershell
only supports, these variables via active directory and bash in turn uses dynamicsPOSIX
that ignores the environment variables. So when you call thecmd.exe
you are actually invoking the DOS environment that provides some system protocols among which are included these variables necessary to execute thenmp
.– Augusto Vasques
Got it. Thanks for the help! Hug!
– Jeferson Ferreira