I have installed react js and run the basics commands on CMD but it's saying and repeating the same every time as a screenshot. I also installed it globally, got node,npm, and created react app version. But when I create-react-app tutorial it's saying an error
C:\Users\ehsan>node -v
'node' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\ehsan>node -v
'node' is not recognized as an internal or external command,
operable program or batch file.
C:\Users\ehsan>node -v
v16.16.0
C:\Users\ehsan>npm -v
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
8.11.0
C:\Users\ehsan>npm install -g create-react-app
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN config global `--global`, `--local` are deprecated. Use `--location=global` instead.
npm WARN deprecated tar#2.2.2: This version of tar is no longer supported, and will not receive security updates. Please upgrade asap.
changed 67 packages, and audited 68 packages in 5s
4 packages are looking for funding
run `npm fund` for details
2 high severity vulnerabilities
Some issues need review, and may require choosing
a different dependency.
Run `npm audit` for details.
C:\Users\ehsan>mkdir tut
Access is denied.
C:\Users\ehsan>create-react-app --version
5.0.1
C:\Users\ehsan>create-react-app tut
node:fs:1349
handleErrorFromBinding(ctx);
^
Error: EPERM: operation not permitted, mkdir 'tut'
at Object.mkdirSync (node:fs:1349:3)
at Object.module.exports.makeDirSync (C:\Users\ehsan\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\mkdirs\make-dir.js:23:13)
at createApp (C:\Users\ehsan\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:257:6)
at C:\Users\ehsan\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:223:9
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -4048,
syscall: 'mkdir',
code: 'EPERM',
path: 'tut'
}
C:\Users\ehsan>create-react-app --version
5.0.1
C:\Users\ehsan>mkdir tut
Access is denied.
C:\Users\ehsan>mkdir -tut
Access is denied.
C:\Users\ehsan>create-react-app tutu
node:fs:1349
handleErrorFromBinding(ctx);
^
Error: EPERM: operation not permitted, mkdir 'tutu'
at Object.mkdirSync (node:fs:1349:3)
at Object.module.exports.makeDirSync (C:\Users\ehsan\AppData\Roaming\npm\node_modules\create-react-app\node_modules\fs-extra\lib\mkdirs\make-dir.js:23:13)
at createApp (C:\Users\ehsan\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:257:6)
at C:\Users\ehsan\AppData\Roaming\npm\node_modules\create-react-app\createReactApp.js:223:9
at processTicksAndRejections (node:internal/process/task_queues:96:5) {
errno: -4048,
syscall: 'mkdir',
code: 'EPERM',
path: 'tutu'
}
Kindly check your node installation, looks like it is either not installed or node has not been added to your environment path variable.
When that is solved running node --version in your terminal would verify.
After you can use
npx create-react-app#latest your_app_name
to create a react app in your desired directory
Related
I am watching this Udemy course on Firebase. The course is a bit dated, initially made maybe 6 years ago.
At some point the author indicates how to use firebase CLI, hence he indicates the command:
~/projects/chatlive]$ npm install -g firebase-tools
I added sudo to avoid permission problems:
~/projects/chatlive]$ sudo npm install -g firebase-tools
Unfortunately, this error message is retrieved:
npm WARN checkPermissions Missing write access to /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! code EROFS
npm ERR! syscall access
npm ERR! path /nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules
npm ERR! errno -30
npm ERR! rofs EROFS: read-only file system, access '/nix/store/nm7vm9d7xbvibazz7kl7xkqgjddqgiby-nodejs-14.18.3/lib/node_modules'
npm ERR! rofs Often virtualized file systems, or other file systems
npm ERR! rofs that don't support symlinks, give this error.
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2022-07-28T15_33_55_544Z-debug.log
I am using NixOS and this is my config file. Since the error message mentions the nix/store I thought it could be related.
Usually, I install things in NixOS changing my configuration.nix and doing sudo nixos-rebuild switch. But I thought it would not be necessary to do it considering npm was managing the installation.
Searching on Nix packages, I can see firebase-tools: link. Now, it seems that tweaking the config file is the way...
In situations like this, what is the best practice?
Should I force trying to install via npm (how?)? Should I go for a new generation of NixOS and a full system rebuild just because of this package?
Is there another possible path? Am I missing something?
Thanks.
If you just want to play around with firebase-tools in a development environment, create a shell.nix file in your working directory and add the following lines:
{ pkgs ? import <nixpkgs> {}}:
pkgs.mkShell {
nativeBuildInputs = [ pkgs.nodePackages.firebase-tools ];
}
Then run nix-shell to start a shell with firebase-tools included. This is considered best practice for local development environments, see https://nixos.wiki/wiki/Development_environment_with_nix-shell .
If you want to try out packages not in nixpkgs repo you should use npm and install a package locally (without -g ). See https://nixos.wiki/wiki/Node.js#Using_npm_install_-g_fails.
I have been able to login to my npm registry manually, ie: on my local machine - but for some reason it's not working when it goes through the CI. The problem here is that after I execute the npm login command, the program is waiting for the manual user input (username, password, email) and I couldn't find a way to send these inputs in the pipeline (where I can't make manual user input):
These different approaches I tried:
1. Copy the npm auth token from my local machine into the environment variables of the gitlab CI/CD Settings, and then just copy them into the global .npmrc at the root directory:
This results in an error (unauthenticated):
$ cd ~
$ pwd
/root
$ echo "//<my_registry_url>:_authToken=$NPM_AUTH_TOKEN" > ~/.npmrc
$ cat .npmrc
<my_registry_url>:_authToken=[MASKED] //<-- the masked value is correct, I had it unmasked before once by mistake...
$ npm whoami
npm ERR! code ENEEDAUTH
npm ERR! need auth This command requires you to be logged in.
npm ERR! need auth You need to authorize this machine using `npm adduser`
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-02T14_29_00_728Z-debug.log
Cleaning up file based variables
00:00
ERROR: Job failed: exit code 1
2. Install npm-cli-login and pass the username, password and email in one line with the npm login command
$ npm install -g npm-cli-login
npm WARN deprecated har-validator#5.1.5: this library is no longer supported
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/request/request/issues/3142
added 567 packages, and audited 568 packages in 46s
33 packages are looking for funding
run `npm fund` for details
found 0 vulnerabilities
// trying to login now
$ npm-cli-login -u $USERNAME -p $API_KEY -e $EMAIL -r $REPOSITORY
info attempt registry request try #1 at 6:17:19 AM
http request PUT [MASKED]-/user/org.couchdb.user:<my correct username>
http 201 [MASKED]-/user/org.couchdb.user:<my correct username> // the login seems to have worked, at least I don't get an error
// then I go to the home directory to check the .npmrc file
$ cd ~
$ pwd
/root
$ cat .npmrc
//<my_registry_url>:_authToken=<eyJ...rest of token> // <-- so this was created correctly at my npm-cli-login command
// then I go back to the angular project folder
$ cd /builds/<my path>/app/src/main/ui
$ ls
README.md
angular.json
browserslist
debug.log
e2e
package.json
src
tsconfig.app.json
tsconfig.spec.json
// and when I now run npm install, it says I'm not authenticated
$ npm install
npm WARN deprecated debug#4.1.1: Debug versions >=3.2.0 <3.2.7 || >=4 <4.3.1 have a low-severity ReDos regression when used in a Node.js environment. It is recommended you upgrade to 3.2.7 or 4.3.1. (https://github.com/visionmedia/debug/issues/797)
npm WARN deprecated axios#0.20.0: Critical security vulnerability fixed in v0.21.1. For more information, see https://github.com/axios/axios/pull/3410
npm WARN deprecated request#2.88.2: request has been deprecated, see https://github.com/reques/request/issues/3142
npm WARN deprecated fsevents#2.1.3: "Please update to latest v2.3 or v2.2"
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 har-validator#5.1.5: this library is no longer supported
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 deprecated urix#0.1.0: Please see https://github.com/lydell/urix#deprecated
npm WARN deprecated resolve-url#0.2.1: https://github.com/lydell/resolve-url#deprecated
npm ERR! code E401
npm ERR! Unable to authenticate, need: Basic realm="Artifactory Realm" // <-- HERE IT FAILED
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-02T06_44_42_972Z-debug.log
Cleaning up file based variables
00:01
ERROR: Job failed: exit code 1
3. Using a here document like this in my gitlab-ci.yml:
- npm login --registry=<my_registry_url> << EOF
- $USERNAME
- $API_KEY
- $EMAIL
- EOF
This results in:
$ npm login --registry=<my_registry_url> << EOF
Username: npm WARN Name may not contain non-url-safe chars
Username: (echo $'\x1b[32;1m$ <my_username>\x1b[0;m') npm ERR! cb() never called!
npm ERR! This is an error with npm itself. Please report this error at:
npm ERR! <https://npm.community>
npm ERR! A complete log of this run can be found in:
npm ERR! /root/.npm/_logs/2021-03-02T13_54_12_317Z-debug.log
ERROR: Job failed: exit code 1
The methods above were maybe not wrong at all, but somehow it only worked for me after using _auth instead of _authToken value in the .npmrc file.
This method is described here and on the jfrog confluence site.
After running this curl command I received everything that I needed to put into my global .npmrc file:
curl -u ${JFROG_USER}:${JFROG_ENCRYPTED_PASSWORD} https://${JFROG_ORG}.jfrog.io/artifactory/api/npm/auth
For anyone who's interested, the full script in my gitlab ci pipeline stage now looks like this:
script:
- npm -v
6.14.10
- node -v
v14.15.4
- cd ~
- pwd
/root
# install angular globally
- npm i -g #angular/cli
# create the config file '.npmrc' for authenticating at jFrog when running 'npm install'.
- cat > .npmrc
- echo _auth = ${NPM_AUTH_TOKEN} >> .npmrc <- This is the token that I received after running the curl command from the tutorial / link above
- echo always-auth = true >> .npmrc
- echo email = ${EMAIL} >> .npmrc
# the next line makes npm look for the packages that are annotated with #<my-private-repo> at the JFrog Repo.
- echo #<my-private-repo>:registry=${UI_JFROG_REGESTRY} >> .npmrc
# change back to the project folder.
- cd /builds/<my-project-folder>/ui
# install all packages + the <my-private-repo> package from JFrog.
- npm install
Instead of using npm login, which doesn't support non-interactivity, I used the auth URL and npmrc. However, I've only gotten this to work with private NPM repositories, and not with https://registry.npmjs.org/. I'm not sure what the AUTH url is for the public NPM registry. If someone finds the AUTH url for NPM, let me know :).
For private NPM repositories, you can avoid npm login by using:
curl -u $USERNAME:$ACCESS_TOKEN https://company.jfrog.io/artifactory/api/npm/auth > ~/.npmrc
This allows us to avoid unnecessary dependencies, and is a single-line-change to a CI job.
Tips:
You can adjust ~/.npmrc to .npmrc to affect the current project only.
For debugging, you can remove > ~/.npmrc and see what the output from the auth URL is.
I was running a dev server after changing my router.js file. Adding a webpage .vue file to the configuration. After doing so it failed to compile with only one errors. This is the output:
This dependency was not found:
* vue/types/umd in ./src/router.js
To install it, you can run: npm install --save vue/types/umd
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\hiberfil.sys'
Error from chokidar (C:\): Error: EBUSY: resource busy or locked, lstat 'C:\swapfile.sys'
I tried the advice, and installed vue/types/umd and it still compiled with an error. I then uploaded my project to GitLab. Deleted the project on my Documents folder then downloaded it again. Used npm install then the typical npm run serve and still the same error.
Check if by accident this kind of import didn't appear in your file ./src/router.js. I had this error when this line appeared in my file. Probably I pressed some key when wanted to use nextTick. In your case it could be attempt to import router. So when I removed this import line everything went back to normal.
import { nextTick } from 'vue/types/umd';
npm install --save vue/types/umd
npm ERR! code ENOLOCAL
npm ERR! Could not install from "vue/types/umd" as it does not contain a package.json file.
npm ERR! A complete log of this run can be found in:
npm ERR! /home/lenovo/.npm/_logs/2022-05-16T17_40_02_280Z-debug.log
We have problem with our build pipeline for npm install below is an excerpt from the log. This error happens quite frequently but not every time. Thus I've tried to solve it by running 2nd Attempt task when 1st failed, but this doesn't solve this error. It happens only on Azure pipeline, npm install run locally works...
This is a TypeScript React app that is built on the azure pipeline.
2020-03-26T10:38:16.6609188Z ##[section]Starting: npm install 2nd Attempt
2020-03-26T10:38:16.6788267Z ==============================================================================
2020-03-26T10:38:16.6788382Z Task : npm
2020-03-26T10:38:16.6788466Z Description : Install and publish npm packages, or run an npm command. Supports npmjs.com and authenticated registries like Azure Artifacts.
2020-03-26T10:38:16.6788532Z Version : 1.165.0
2020-03-26T10:38:16.6788593Z Author : Microsoft Corporation
2020-03-26T10:38:16.6788672Z Help : https://learn.microsoft.com/azure/devops/pipelines/tasks/package/npm
2020-03-26T10:38:16.6788736Z ==============================================================================
2020-03-26T10:38:17.2859304Z SYSTEMVSSCONNECTION exists true
2020-03-26T10:38:17.8968387Z SYSTEMVSSCONNECTION exists true
2020-03-26T10:38:18.3178413Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C "C:\temp\_work\_tool\node\8.17.0\x64\npm.cmd --version"
2020-03-26T10:38:19.5417276Z 6.13.4
2020-03-26T10:38:19.5546292Z SYSTEMVSSCONNECTION exists true
2020-03-26T10:38:19.6804593Z SYSTEMVSSCONNECTION exists true
2020-03-26T10:38:22.0732149Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C "C:\temp\_work\_tool\node\8.17.0\x64\npm.cmd config list"
2020-03-26T10:38:23.2654131Z ; cli configs
2020-03-26T10:38:23.2654913Z metrics-registry = "https://MyCompany.pkgs.visualstudio.com/_packaging/MyCompany-Artifacts/npm/registry/"
2020-03-26T10:38:23.2655225Z scope = ""
2020-03-26T10:38:23.2655510Z user-agent = "npm/6.13.4 node/v8.17.0 win32 x64"
2020-03-26T10:38:23.2655752Z
2020-03-26T10:38:23.2656000Z ; environment configs
2020-03-26T10:38:23.2656265Z userconfig = "C:\\temp\\_work\\4\\npm\\12184.npmrc"
2020-03-26T10:38:23.2656536Z
2020-03-26T10:38:23.2656848Z ; project config C:\temp\_work\4\s\.npmrc
2020-03-26T10:38:23.2657206Z always-auth = true
2020-03-26T10:38:23.2657545Z registry = "https://MyCompany.pkgs.visualstudio.com/_packaging/MyCompany-Artifacts/npm/registry/"
2020-03-26T10:38:23.2657994Z
2020-03-26T10:38:23.2658276Z ; node bin location = C:\temp\_work\_tool\node\8.17.0\x64\node.exe
2020-03-26T10:38:23.2658527Z ; cwd = C:\temp\_work\4\s
2020-03-26T10:38:23.2658728Z ; HOME = C:\Users\sysadmin
2020-03-26T10:38:23.2658967Z ; "npm config ls -l" to show all defaults.
2020-03-26T10:38:23.2659419Z
2020-03-26T10:38:23.2668324Z [command]C:\WINDOWS\system32\cmd.exe /D /S /C "C:\temp\_work\_tool\node\8.17.0\x64\npm.cmd install --no-optional"
...
2020-03-26T10:40:29.4831279Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\number\is-integer\shim.js'
2020-03-26T10:40:29.4831530Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\number\is-nan\shim.js'
2020-03-26T10:40:29.4831641Z npm WARN jest-image-snapshot#2.11.0 requires a peer of jest#>=20 <=24 but none is installed. You must install peer dependencies yourself.
2020-03-26T10:40:29.4831748Z npm WARN jest-to-match-shape-of#1.2.0 requires a peer of jest#21.x but none is installed. You must install peer dependencies yourself.
2020-03-26T10:40:29.4831844Z npm WARN react-touch-screen-keyboard#0.3.15 requires a peer of react#~0.14.8 || ^15.0.0 but none is installed. You must install peer dependencies yourself.
2020-03-26T10:40:29.4831964Z npm WARN react-touch-screen-keyboard#0.3.15 requires a peer of react-dom#~0.14.8 || ^15.0.0 but none is installed. You must install peer dependencies yourself.
2020-03-26T10:40:29.4832050Z npm WARN The package devtron is included as both a dev and production dependency.
2020-03-26T10:40:29.4832156Z npm WARN The package electron-devtools-installer is included as both a dev and production dependency.
2020-03-26T10:40:29.4832225Z
2020-03-26T10:40:29.4832458Z npm ERR! Unexpected end of JSON input while parsing near '...ents/code/npm/man/man'
2020-03-26T10:40:29.4832557Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\number\is-safe-integer\shim.js'
2020-03-26T10:40:29.4832671Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\object\assign\shim.js'
2020-03-26T10:40:29.4832770Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\object\entries\shim.js'
2020-03-26T10:40:29.4832867Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\object\keys\shim.js'
...
2020-03-26T10:40:29.5685813Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\iterable\validate.js'
2020-03-26T10:40:29.5685897Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\iterable\validate.js'
2020-03-26T10:40:29.5686017Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\promise\.eslintrc.json'
2020-03-26T10:40:29.5686284Z npm WARN tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\promise\.eslintrc.json'
2020-03-26T10:40:29.5686347Z
2020-03-26T10:40:29.5686418Z npm ERR! A complete log of this run can be found in:
2020-03-26T10:40:29.5686499Z npm ERR! C:\Users\sysadmin\AppData\Roaming\npm-cache\_logs\2020-03-26T10_40_26_002Z-debug.log
2020-03-26T10:40:29.5694378Z Found npm debug log, make sure the path matches with the one in npm's output: C:\Users\sysadmin\AppData\Roaming\npm-cache\_logs\2020-03-26T10_40_26_002Z-debug.log
2020-03-26T10:40:29.5694810Z 8004 silly decomposeActions build callsites#3.1.0
2020-03-26T10:40:29.5695055Z 8005 silly decomposeActions install callsites#3.1.0
2020-03-26T10:40:29.5695256Z 8006 silly decomposeActions postinstall callsites#3.1.0
2020-03-26T10:40:29.5695498Z 8007 silly decomposeActions finalize callsites#3.1.0
...
2020-03-26T10:40:29.7045575Z 18555 warn tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\math\sinh\shim.js'
2020-03-26T10:40:29.7045685Z 18556 warn tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\math\tanh\shim.js'
2020-03-26T10:40:29.7046044Z 18557 warn tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\math\trunc\shim.js'
2020-03-26T10:40:29.7046198Z 18558 warn tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\number\is-finite\shim.js'
2020-03-26T10:40:29.7046311Z 18559 warn tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\number\is-integer\shim.js'
2020-03-26T10:40:29.7046648Z 18560 warn tar ENOENT: no such file or directory, open 'C:\temp\_work\4\s\node_modules\.staging\es5-ext-01671651\test\number\is-nan\shim.js'
2020-03-26T10:40:29.7048565Z 18561 verbose unlock done using C:\Users\sysadmin\AppData\Roaming\npm-cache\_locks\staging-be6c2a9d7e735ae4.lock for C:\temp\_work\4\s\node_modules\.staging
2020-03-26T10:40:29.7049239Z 18562 timing stage:rollbackFailedOptional Completed in 4ms
2020-03-26T10:40:29.7049393Z 18563 timing stage:runTopLevelLifecycles Completed in 117228ms
2020-03-26T10:40:29.7049514Z 18564 silly saveTree omni-ui#2.0.0-alpha.3
2020-03-26T10:40:29.7049594Z 18564 silly saveTree +-- #types/hammerjs#2.0.36
2020-03-26T10:40:29.7049906Z 18564 silly saveTree +-- #types/jest#24.0.18
2020-03-26T10:40:29.7050068Z 18564 silly saveTree | `-- #types/jest-diff#20.0.1
2020-03-26T10:40:29.7050147Z 18564 silly saveTree +-- #types/lodash#4.14.149
2020-03-26T10:40:29.7050220Z 18564 silly saveTree +-- #types/node#12.7.12
...
2020-03-26T10:40:29.7913586Z 18569 warn The package devtron is included as both a dev and production dependency.
2020-03-26T10:40:29.7913833Z 18570 warn The package electron-devtools-installer is included as both a dev and production dependency.
2020-03-26T10:40:29.7914064Z 18571 verbose stack SyntaxError: Unexpected end of JSON input while parsing near '...ents/code/npm/man/man'
2020-03-26T10:40:29.7914343Z 18571 verbose stack at JSON.parse (<anonymous>)
2020-03-26T10:40:29.7914606Z 18571 verbose stack at parseJson (C:\temp\_work\_tool\node\8.17.0\x64\node_modules\npm\node_modules\json-parse-better-errors\index.js:7:17)
2020-03-26T10:40:29.7914922Z 18571 verbose stack at consumeBody.call.then.buffer (C:\temp\_work\_tool\node\8.17.0\x64\node_modules\npm\node_modules\node-fetch-npm\src\body.js:96:50)
2020-03-26T10:40:29.7915178Z 18571 verbose stack at <anonymous>
2020-03-26T10:40:29.7919986Z 18571 verbose stack at process._tickCallback (internal/process/next_tick.js:189:7)
2020-03-26T10:40:29.7920359Z 18572 verbose cwd C:\temp\_work\4\s
2020-03-26T10:40:29.7920619Z 18573 verbose Windows_NT 10.0.18362
2020-03-26T10:40:29.7920908Z 18574 verbose argv "C:\\temp\\_work\\_tool\\node\\8.17.0\\x64\\node.exe" "C:\\temp\\_work\\_tool\\node\\8.17.0\\x64\\node_modules\\npm\\bin\\npm-cli.js" "install" "--no-optional"
2020-03-26T10:40:29.7923019Z 18575 verbose node v8.17.0
2020-03-26T10:40:29.7923275Z 18576 verbose npm v6.13.4
2020-03-26T10:40:29.7923540Z 18577 error Unexpected end of JSON input while parsing near '...ents/code/npm/man/man'
2020-03-26T10:40:29.7923796Z 18578 verbose exit [ 1, true ]
2020-03-26T10:40:29.7927345Z
2020-03-26T10:40:29.7944531Z ##[error]Error: Npm failed with return code: 1
Delete package-lock.json file and re run your pipeline
REMOVE NPM from your custom script command arguments
Azure pipeline task PREPENDS NPM Already ...
Full explanation:
when using the NPM task in Azure pipelines the task itself prepends npm.cmd which is equivalent to the 'npm' command in npm scripts.
This is a bit unusual since most script begin with npm, but the reason custom tasks have failed is because entering a custom task beginning with the npm command, will cause it to fail, as the azure pipeline task is already running it,
thus the custom task command arguments should exclude the initial npm command which is normally prepended on many tasks.
Sometimes this happen due to missing node modules.
Follow this steps to identify issues
in your local environment delete node_modules folder.
run npm i command (this will download all necessary node modules).
run ng build (this will show now if is there any issues).
if is there any issues fix them (add/remove node modules).
If all good in local environment, push changes to source control and trigger a new build.
This may occur because your package.json path or our tasks working directory option.
For the 'NPM Install' I suggest before this task add temporally a command line task, to do a 'dir' or 'ls' to see how your directory has ben named (usually some underscores may be added), and confirm where your 'package.json' is.
For 'NPM Install' I use this system variable for your working folder :
$(System.DefaultWorkingDirectory)/_YourProject
and the command line:
npm install -g
For the artifacts and stage tasks, once one has been selected, it's requested to identify it with a source alias.
On your stage, verify all your tasks matches the working directory with source alias.
I hope this may help.
I have Vue application that I don't run for a while and now I cannot start development server?! In meanwhile something updated and that don't work. I tried new clean vue/vuetify install and same problem!
Build for production works normally, only run development server don't work.
And important notice: when run "npm run serve" in command prompt (outside VS Code), it works normally. That not work only in VS Code Terminal. What is problem?
Node version is v10.16.0
Npm version is 6.10.3
VS Code About:
Commit: 036a6b1d3ac84e5ca96a17a44e63a87971f8fcc8
Date: 2019-08-08T02:33:50.993Z
Electron: 4.2.7
Chrome: 69.0.3497.128
Node.js: 10.11.0
V8: 6.9.427.31-electron.0
OS: Windows_NT x64 10.0.17763
Error (from terminal window):
> Executing task: npm run serve <
> portal#0.1.0 serve d:\Wamp64\www\portal
> vue-cli-service serve
INFO Starting development server...
10% building 2/2 modules 0 active ERROR Error: Watching remote files is not supported.
Error: Watching remote files is not supported.
at Server.setupWatchStaticFeature (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:405:13)
at Object.watchContentBase (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:477:14)
at forEach (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:550:24)
at Array.forEach (<anonymous>)
at Server.setupFeatures (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:549:49)
at new Server (d:\Wamp64\www\portal\node_modules\webpack-dev-server\lib\Server.js:125:10)
at serve (d:\Wamp64\www\portal\node_modules\#vue\cli-service\lib\commands\serve.js:139:20)
at process._tickCallback (internal/process/next_tick.js:68:7)
at Function.Module.runMain (internal/modules/cjs/loader.js:832:11)
at startup (internal/bootstrap/node.js:283:19)
at bootstrapNodeJSCore (internal/bootstrap/node.js:622:3)
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! portal#0.1.0 serve: `vue-cli-service serve`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the portal#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! C:\Users\Sasa Gosovic\AppData\Roaming\npm-cache\_logs\2019-08-11T10_35_40_418Z-debug.log
The terminal process terminated with exit code: 1
Press any key to close the terminal.
Exactly the same issue here. I resolved it by rolling back the version of webpack-dev-server.
npm install webpack-dev-server#3.7.2 --save-dev
Looks like the setupWatchStaticFeature function has changed between 3.7.2 and 3.8.0 which is triggering the issue.
You can eddit the vue.config.js file, adding following code:
devServer: {
contentBase: './public'
}
More details: https://github.com/webpack/webpack-dev-server/issues/2190#issuecomment-520670599
Until the issue is open, a workaround could be to use Git Bash instead of Windows command line to run npm run serve. I modified Server.js to output the contentBase variable. When using Windows command line or Vue UI, the variable contained "c:\...". Using Git Bash on my Windows 10 machine it contains "C:\..." and it worked.