When running npm commands using a Windows computer, you may frequently see an npm error that starts with Windows_NT 6.1.7601.
The example error looks like this:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Programs\\nodejs\\node.exe"
"D:\\Programs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
"install" "webpack"
npm ERR! node v10.24.1
npm ERR! npm v6.14.12
npm ERR! code ENOSELF
Windows_NT is the name of the Windows operating system that’s included in the product version text. Version 6.1.7601 means you’re using Windows 7 Operating System (link)
The error Windows_NT has nothing to do with your Windows computer. It’s similar to how you see the name Darwin when you trigger an npm error on Mac devices:
npm ERR! Darwin 21.4.0
npm ERR! argv "/Users/nsebhastian/.nvm/versions/node/v16.13.0/bin/node"
"/Users/nsebhastian/.nvm/versions/node/v16.13.0/bin/npm"
"install" "webpack"
npm ERR! node v16.13.0
npm ERR! npm v8.1.0
npm ERR! unsupported proxy protocol: 'username:'
To resolve this kind of error, you need to look further into the error details generated by your npm command.
For example, the error code ENOSELF
is triggered when you try to install a module that has the same name as the project name in your package.json
file:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Programs\\nodejs\\node.exe"
"D:\\Programs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
"install" "webpack"
npm ERR! node v10.24.1
npm ERR! npm v6.14.12
npm ERR! code ENOSELF
npm ERR! Refusing to install package with name "webpack" under a package
npm ERR! also called "webpack". Did you name your project the same
npm ERR! as the dependency you're installing?
npm ERR!
npm ERR! For more information, see:
To solve this error, you need to change the name
property in your package.json file:
{
"name": "webpack",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
Once the project name has changed, you should be able to install the dependency successfully.
To fix the Windows_NT error, you need to look at the error description below the node
and npm
versions output as shown above.
Here’s another error:
npm ERR! Windows_NT 6.1.7601
npm ERR! argv "D:\\Programs\\nodejs\\node.exe"
"D:\\Programs\\nodejs\\node_modules\\npm\\bin\\npm-cli.js"
"start"
npm ERR! node v10.24.1
npm ERR! npm v6.14.12
npm ERR! Missing script: "start"
The error above appears when you run the npm start
command but you don’t have the start
script in your package.json
file.
You need to let Node knows what to run with npm start
in the scripts
property as shown below:
{
"name": "my-app",
"version": "1.0.0",
"description": "",
"main": "index.js",
"scripts": {
"start": "node index",
"test": "echo \"Error: no test specified\" && exit 1"
},
"keywords": [],
"author": "",
"license": "ISC"
}
To conclude, the error Windows_NT 6.1.7601
is just npm letting you know the Operating System used by your device. Any kind of npm error could return this output.
The OS version was added to the output because it may help npm developers and maintainers investigate reported errors.
The actual problem with the command you run is commonly stated under the node
and npm
versions output, so you need to look there to fix the issue.
Additionally, you can run the command with the --verbose
option to make npm return more details on the problem:
npm install --verbose
# or
npm start --verbose
The option should help you to find the real issue with your command.
I hope this tutorial has been useful for you. 🙏