Node.js Error v6.11.5 in Windows 10

3

I installed Node.js to study Angular 2, I downloaded it from the node site, but after installing it, when I type npm start in the cmd of my PC, I get the error below, I am giving the command in the file folder package.json C:\Program Files\nodejs\node_modules\npm Does anyone have any idea how to solve it? Please! :)

C:\Users\Sarah Santana>node -v
v6.11.5

C:\Users\Sarah Santana>cd\Program Files\nodejs\node_modules\npm

C:\Program Files\nodejs\node_modules\npm>npm start
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10

npm ERR! missing script: start
npm ERR!
npm ERR! If you need help, you may report this error at:
npm ERR!     <https://github.com/npm/npm/issues>
npm ERR! Windows_NT 10.0.15063
npm ERR! argv "C:\Program Files\nodejs\node.exe" "C:\Program Files\nodejs\node_modules\npm\bin\npm-cli.js" "start"
npm ERR! node v6.11.5
npm ERR! npm  v3.10.10
npm ERR! path C:\Program Files\nodejs\node_modules\npm\npm-debug.log.3610650318
npm ERR! code EPERM
npm ERR! errno -4048
npm ERR! syscall open

npm ERR! Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_modules\npm\npm-debug.log.3610650318'
npm ERR!     at Error (native)
npm ERR!  { Error: EPERM: operation not permitted, open 'C:\Program Files\nodejs\node_modules\npm\npm-debug.log.3610650318'
npm ERR!     at Error (native)
npm ERR!   errno: -4048,
npm ERR!   code: 'EPERM',
npm ERR!   syscall: 'open',
npm ERR!   path: 'C:\Program Files\nodejs\node_modules\npm\npm-debug.log.3610650318' }
npm ERR!
npm ERR! Please try running this command again as root/Administrator.

npm ERR! Please include the following file with any support request:
npm ERR!     C:\Program Files\nodejs\node_modules\npm\npm-debug.log
    
asked by anonymous 29.10.2017 / 01:31

1 answer

2

Apparently you are running the command npm start in the wrong location ... you are running inside the installation folder in NodeJs .

You should create a folder for your project and add the .js runtime file for your application. To use the npm start command there should be a package.json file in your folder with instructions to load example "scripts":

index.js

// um simples console
console.log('Hello World!')

package.json

{
   "name": "nome-de-sua-aplicação",
   "main": "index.js",
   "version": "1.0.0",
   "scripts": {
       "start": "index"
   }
}

Note that the package.json file can contain a lot of information. In this example, using npm start will execute the file within the scripts.start statement through this command you can also add optional arguments.

References

NPM Documentation package.json

NPM Documentation start command

editing

Note: The above example is suggested to use within directories common to the user (desktop, documents, etc ...) however, its% error% reports a lack of administrative privileges because it was running inside folders commonly protected by the operating system.

You can run log commands even within protected system folders, if this is the case you should start the NodeJs command (CMD) with admin privileges.

    
29.10.2017 / 01:52