npm init error - cannot create application - node.js

Totally new to NodeJS
when trying to create a new application getting the following :
it does not create instead exits with a error log at the location
H:\app>npm init
This utility will walk you through creating a package.json file.
It only covers the most common items, and tries to guess sensible defaults.
See `npm help json` for definitive documentation on these fields
and exactly what they do.
Use `npm install <pkg> --save` afterwards to install a package and
save it as a dependency in the package.json file.
Press ^C at any time to quit.
name: (app)
H:\app>
Contents of 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 'init' ]
2 info using npm#3.10.10
3 info using node#v6.11.0
4 verbose stack Error: read EINVAL
4 verbose stack at exports._errnoException (util.js:1018:11)
4 verbose stack at TTY.onread (net.js:568:26)
5 verbose cwd H:\app
6 error Windows_NT 6.1.7601
7 error argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "init"
8 error node v6.11.0
9 error npm v3.10.10
10 error code EINVAL
11 error errno EINVAL
12 error syscall read
13 error read EINVAL
14 error If you need help, you may report this error at:
14 error <https://github.com/npm/npm/issues>
15 verbose exit [ 1, true ]
any help is much appreciated!

Try this command: npm init - y
By default the command above will create a default package.json at the current directory. It seems there is some problem regarding access. Once the default package.json file is created you can update it afterwards.

Related

An unexpected error occurred: "EPERM: operation not permitted"

I have installed ReactJS to work on some project but this mistakes are making me sick.
First error appear when I tried to add package for my project.
So , I used :
yarn add #material-ui/icons
and after that It was fetching.
And I got this error message on the terminal line :
error An unexpected error occurred: "EPERM: operation not permitted, unlink 'C:\\React\\MyProject\\node_modules\\node-sass\\vendor\\win32-x64-93\\bindiinfo Visit https://yarnpkg.com/en/docs/cli/add for documentation about this command.
I found some solutions and wanted to try. Whenever I try to use install command, it does not let me.
It gives this error
npm ERR! cb.apply is not a function
npm ERR! A complete log of this run can be found in:
npm ERR! C:\Users\XXXXXX\AppData\Roaming\npm-cache\_logs\2021-11-14T00_08_12_781Z-debug.log
enter code here
and whenever I click this error log, here is what I see.
0 info it worked if it ends with ok
1 verbose cli [
1 verbose cli 'C:\\Program Files\\nodejs\\node.exe',
1 verbose cli 'C:\\Users\\XXXXXXXX\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install',
1 verbose cli '-g',
1 verbose cli 'yarn'
1 verbose cli ]
2 info using npm#5.3.0
3 info using node#v16.13.0
4 verbose npm-session 95556b4f7a104717
5 silly install loadCurrentTree
6 silly install readGlobalPackageData
7 http fetch GET 200 https://registry.npmjs.org/yarn 188ms
8 http fetch GET 200 https://registry.npmjs.org/yarn/-/yarn-1.22.17.tgz 120ms
9 silly pacote tag manifest for yarn#latest fetched in 352ms
10 verbose stack TypeError: cb.apply is not a function
10 verbose stack at C:\Users\XXXXXXX\AppData\Roaming\npm\node_modules\npm\node_modules\graceful-fs\polyfills.js:287:18
10 verbose stack at FSReqCallback.oncomplete (node:fs:199:5)
11 verbose cwd D:\React\projem
12 verbose Windows_NT 10.0.19043
13 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Users\\XXXXXXXX\\AppData\\Roaming\\npm\\node_modules\\npm\\bin\\npm-cli.js" "install" "-g" "yarn"
14 verbose node v16.13.0
15 verbose npm v5.3.0
16 error cb.apply is not a function
17 verbose exit [ 1, true ]
Please help me or I'll drive crazy so soon!
All the best everyone and THANK YOU! for your help.
Please stop the development server and install or add the packages.
I faced same issue when I tried to install the blueprint package using yarn, I solved it by using npm package manager (npm install)

Neither NPM nor GitBash are operational at the moment. How can that be solved?

I am new to GitBash and do not know how it functions within VisualStudio Code. The challenge that I am faced with is enabling React.js to operate within VSCode. As it stands, the error message below is what's being output at this time.
D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\node_modules\babel-jest (version: 27.2.4)
Manually installing incompatible versions is known to cause hard-to-debug issues.
If you would prefer to ignore this check, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That will permanently disable this message but you might encounter other issues.
To fix the dependency tree, try following the steps below in the exact order:
1. Delete package-lock.json (not package.json!) and/or yarn.lock in your project folder.
2. Delete node_modules in your project folder.
3. Remove "babel-jest" from dependencies and/or devDependencies in the package.json file in your project folder.
4. Run npm install or yarn, depending on the package manager you use.
In most cases, this should be enough to fix the problem.
If this has not helped, there are a few other things you can try:
5. If you used npm, install yarn (http://yarnpkg.com/) and repeat the above steps with it instead.
This may help because npm has known issues with package hoisting which may get resolved in future versions.
6. Check if D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\node_modules\babel-jest is outside your project directory.
For example, you might have accidentally installed something in your home folder.
7. Try running npm ls babel-jest in your project folder.
This will tell you which other package (apart from the expected react-scripts) installed babel-jest.
If nothing else helps, add SKIP_PREFLIGHT_CHECK=true to an .env file in your project.
That would permanently disable this preflight check in case you want to proceed anyway.
P.S. We know this message is long but please read the steps above :-) We hope you find them helpful!
npm ERR! code ELIFECYCLE
npm ERR! errno 1
npm ERR! affiliate-marketing-project#0.1.0 start: `react-scripts start`
npm ERR! Exit status 1
npm ERR!
npm ERR! Failed at the affiliate-marketing-project#0.1.0 start 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\Refined_Silver\AppData\Roaming\npm-cache\_logs\2021-10-12T16_55_33_704Z-debug.log
PS D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\affiliate-marketing-project>
I followed the instructions above, but to no avail. For starters, "babel-jest" did not exist within the dependencies section of my package.json.
Below is the message that I have been receiving, which is inside of the debug log for React within Visual Studio Code.
0 info it worked if it ends with ok
1 verbose cli [
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 'start'
1 verbose cli ]
2 info using npm#6.14.15
3 info using node#v14.18.0
4 verbose run-script [ 'prestart', 'start', 'poststart' ]
5 info lifecycle affiliate-marketing-project#0.1.0~prestart: affiliate-marketing-project#0.1.0
6 info lifecycle affiliate-marketing-project#0.1.0~start: affiliate-marketing-project#0.1.0
7 verbose lifecycle affiliate-marketing-project#0.1.0~start: unsafe-perm in lifecycle true
8 verbose lifecycle affiliate-marketing-project#0.1.0~start: PATH: C:\Program Files\nodejs\node_modules\npm\node_modules\npm-lifecycle\node-gyp-bin;D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\affiliate-marketing-project\node_modules\.bin;C:\Program Files (x86)\Common Files\Intel\Shared Libraries\redist\intel64\compiler;C:\Python39\Scripts\;C:\Python39\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\ProgramData\chocolatey\bin;C:\Program Files\nodejs\;C:\Program Files (x86)\Yarn\bin\;C:\Program Files\Git\cmd;C:\Ruby26-x64\bin;C:\Users\Refined_Silver\AppData\Local\Microsoft\WindowsApps;C:\Users\Refined_Silver\AppData\Local\Programs\Microsoft VS Code\bin;C:\ProgramData\Refined_Silver\GitHubDesktop\bin;C:\Users\Refined_Silver\AppData\Roaming\npm;C:\Users\Refined_Silver\AppData\Local\Yarn\bin
9 verbose lifecycle affiliate-marketing-project#0.1.0~start: CWD: D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\affiliate-marketing-project
10 silly lifecycle affiliate-marketing-project#0.1.0~start: Args: [ '/d /s /c', 'react-scripts start' ]
11 silly lifecycle affiliate-marketing-project#0.1.0~start: Returned: code: 1 signal: null
12 info lifecycle affiliate-marketing-project#0.1.0~start: Failed to exec start script
13 verbose stack Error: affiliate-marketing-project#0.1.0 start: `react-scripts start`
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:332:16)
13 verbose stack at EventEmitter.emit (events.js:400:28)
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:400:28)
13 verbose stack at maybeClose (internal/child_process.js:1058:16)
13 verbose stack at Process.ChildProcess._handle.onexit (internal/child_process.js:293:5)
14 verbose pkgid affiliate-marketing-project#0.1.0
15 verbose cwd D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\affiliate-marketing-project
16 verbose Windows_NT 10.0.19043
17 verbose argv "C:\\Program Files\\nodejs\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
18 verbose node v14.18.0
19 verbose npm v6.14.15
20 error code ELIFECYCLE
21 error errno 1
22 error affiliate-marketing-project#0.1.0 start: `react-scripts start`
22 error Exit status 1
23 error Failed at the affiliate-marketing-project#0.1.0 start script.
23 error This is probably not a problem with npm. There is likely additional logging output above.
24 verbose exit [ 1, true ]
I am not-at-all familiar with how to read what is happening within the NPM / GitBash start-up process. Everything was working fine until I installed GitBash. I would appreciate some assistance with how GitBash functions.
I would appreciate any insight as to how this can be solved. Thank you.
Have you followed step 6 and removed babel-jest in D:\_Dearest_Lord_God,_please_intuitively_reveal_the_things_that_used_to_baffle_me]\_Projects-React]\node_modules ?
react-scripts comes with babel-jest. It warns you about the conflicting installation up the tree.

Trying to Install Grunt-Shopify

(https://github.com/wilr/grunt-shopify)
I am very new to anything related to grunt and node.js
Here is the error I am getting:
0 info it worked if it ends with ok
1 verbose cli [ 'node',
1 verbose cli 'C:\Users\Steven\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js',
1 verbose cli 'install',
1 verbose cli 'grunt-shopify',
1 verbose cli '--save-dev' ]
2 info using npm#2.4.1
3 info using node#v0.10.36
4 verbose stack Error: EISDIR, read
5 verbose cwd C:\Users\Steven\Desktop\Sublime Text 2\shop
6 error Windows_NT 6.2.9200
7 error argv "node" "C:\Users\Steven\AppData\Roaming\npm\node_modules\npm\bin\npm-cli.js" "install" "grunt-shopify" "--save-dev"
8 error node v0.10.36
9 error npm v2.4.1
10 error code EISDIR
11 error errno 28
12 error EISDIR, read
13 error If you need help, you may report this error at:
13 error http://github.com/npm/npm/issues
14 verbose exit [ 28, true ]
Can anyone tell me what I am doing wrong?? We think it may be a permission issue even though we are running command prompt as admin.
Thanks!

Why can't execute "npm start" or even other npm commands?

What could the problem be? I get this error whenever i run "npm start" or even basic commands like "npm install." I am trying to figure out why it can't run.
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 'start' ]
2 info using npm#1.4.28
3 info using node#v0.10.32
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart nodetest1#0.0.0
7 info start nodetest1#0.0.0
8 verbose unsafe-perm in lifecycle true
9 info nodetest1#0.0.0 Failed to exec start script
10 error nodetest1#0.0.0 start: `node ./bin/www`
10 error spawn ENOENT
11 error Failed at the nodetest1#0.0.0 start script.
11 error This is most likely a problem with the nodetest1 package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error node ./bin/www
11 error You can get their info via:
11 error npm owner ls nodetest1
11 error There is likely additional logging output above.
12 error System Windows_NT 6.1.7601
13 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error cwd C:\Users\Kijo\nodetest1
15 error node -v v0.10.32
16 error npm -v 1.4.28
17 error syscall spawn
18 error code ELIFECYCLE
19 error errno ENOENT
20 verbose exit [ 1, true ]
#nox3011
Here is a printout of my directory, if it can help.
You have a ENOENT error which means it was not able to locate some required file or directory. Mostly with ./bin/www
Try running npm start by changing directory to C:\Program Files\node

npm start Error: Cannot find module 'C:\' and Exit status 8

I have a little NPM challenge for you.
Tech. info:
OS: Windows 7
I'm trying to:
cd to the project folder --> run npm start, "start" is configured in the package.json as "node ."
I get the following error:
**** npm start Error: Cannot find module 'C:\'
**** Exit status 8
**** the npm-debug.log look like the below:
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 'start' ]
2 info using npm#1.3.24
3 info using node#v0.10.25
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose run-script [ 'prestart', 'start', 'poststart' ]
6 info prestart tile-tease-api#0.1.0
7 info start tile-tease-api#0.1.0
8 verbose unsafe-perm in lifecycle true
9 info tile-tease-api#0.1.0 Failed to exec start script
10 error tile-tease-api#0.1.0 start: `node .`
10 error Exit status 8
11 error Failed at the tile-tease-api#0.1.0 start script.
11 error This is most likely a problem with the tile-tease-api package,
11 error not with npm itself.
11 error Tell the author that this fails on your system:
11 error node .
11 error You can get their info via:
11 error npm owner ls tile-tease-api
11 error There is likely additional logging output above.
12 error System Windows_NT 6.1.7601
13 error command "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "start"
14 error cwd "FOLDER OF PROJECT - EDITED"
15 error node -v v0.10.25
16 error npm -v 1.3.24
17 error code ELIFECYCLE
18 verbose exit [ 1, true ]
During my troubleshooting I have found:
It seems to have something to do with the invoking path. As I have no problems if I do
** instead of "node ." in the start definition in the package.json file I define the actual path
** or if i execute "node ." in a cmd directly instead of doing it through the "npm start" command.
The issue is that I'm sharing the project between other developers and they are developing on Mac's. On their setup it works with the start "node ."....and it would be cumbersome to have different package.json file and would beat the purpose of using Git.....
Have anyone bumped into this problem before and have any ideas for what I can do to overcome this.
I think it's a bug in node.js core, and it might have something to do with the fact that require() doesn't accept "." as a local path.
Try to write node ./ instead.

Resources