workshopper / how-to-npm

A module to teach you how to module.
https://www.npmjs.com/package/how-to-npm
ISC License
1.11k stars 219 forks source link

Package Niceties fails on verify #80

Closed the-octagon closed 7 years ago

the-octagon commented 7 years ago

Trying to verify adding repo field to package.json and creating README.md.

Terminal output:

andy@fordprefect$ how-to-npm>>sudo how-to-npm verify
ERROR: No adventure is currently selected. Select an adventure from the menu.
Mon Dec 26 16:19:43
andy@fordprefect$ how-to-npm>>how-to-npm verify
npm ERR! Linux 4.8.13-200.fc24.x86_64
npm ERR! argv "/usr/bin/node" "/usr/bin/npm" "i"
npm ERR! node v7.3.0
npm ERR! npm  v4.0.5
npm ERR! path /home/andy/projects/node.js/how-to-npm/node_modules/.staging
npm ERR! code EACCES
npm ERR! errno -13
npm ERR! syscall mkdir

npm ERR! Error: EACCES: permission denied, mkdir '/home/andy/projects/node.js/how-to-npm/node_modules/.staging'
npm ERR!  { Error: EACCES: permission denied, mkdir '/home/andy/projects/node.js/how-to-npm/node_modules/.staging'
npm ERR!   errno: -13,
npm ERR!   code: 'EACCES',
npm ERR!   syscall: 'mkdir',
npm ERR!   path: '/home/andy/projects/node.js/how-to-npm/node_modules/.staging' }
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!     /home/andy/projects/node.js/how-to-npm/npm-debug.log

Uh oh!
It looks like something went wrong
#########################################
###   YOUR SOLUTION IS NOT CORRECT!   ###
#########################################

contents of npm-debug.log:

0 info it worked if it ends with ok
1 verbose cli [ '/usr/bin/node', '/usr/bin/npm', 'i' ]
2 info using npm@4.0.5
3 info using node@v7.3.0
4 silly loadCurrentTree Starting
5 silly install loadCurrentTree
6 silly install readLocalPackageData
7 silly install normalizeTree
8 silly loadCurrentTree Finishing
9 silly loadIdealTree Starting
10 silly install loadIdealTree
11 silly cloneCurrentTree Starting
12 silly install cloneCurrentTreeToIdealTree
13 silly cloneCurrentTree Finishing
14 silly loadShrinkwrap Starting
15 silly install loadShrinkwrap
16 silly loadShrinkwrap Finishing
17 silly loadAllDepsIntoIdealTree Starting
18 silly install loadAllDepsIntoIdealTree
19 silly loadAllDepsIntoIdealTree Finishing
20 silly loadIdealTree Finishing
21 silly currentTree @the-octagon/how-to-npm@1.0.0
21 silly currentTree └── @linclark/pkg@1.0.2
22 silly idealTree @the-octagon/how-to-npm@1.0.0
22 silly idealTree └── @linclark/pkg@1.0.2
23 silly generateActionsToTake Starting
24 silly install generateActionsToTake
25 silly generateActionsToTake Finishing
26 silly diffTrees action count 0
27 silly decomposeActions action count 0
28 silly runTopLevelLifecycles Starting
29 silly install runPreinstallTopLevelLifecycles
30 silly preinstall @the-octagon/how-to-npm@1.0.0
31 info lifecycle @the-octagon/how-to-npm@1.0.0~preinstall: @the-octagon/how-to-npm@1.0.0
32 silly lifecycle @the-octagon/how-to-npm@1.0.0~preinstall: no script for preinstall, continuing
33 silly executeActions Starting
34 silly install executeActions
35 silly doSerial global-install 0
36 silly doParallel fetch 0
37 verbose correctMkdir /home/andy/.npm/_locks correctMkdir not in flight; initializing
38 verbose lock using /home/andy/.npm/_locks/staging-7356ea95aafd18c0.lock for /home/andy/projects/node.js/how-to-npm/node_modules/.staging
39 verbose unlock done using /home/andy/.npm/_locks/staging-7356ea95aafd18c0.lock for /home/andy/projects/node.js/how-to-npm/node_modules/.staging
40 silly rollbackFailedOptional Starting
41 silly rollbackFailedOptional Finishing
42 silly runTopLevelLifecycles Finishing
43 silly install printInstalled
44 verbose stack Error: EACCES: permission denied, mkdir '/home/andy/projects/node.js/how-to-npm/node_modules/.staging'
45 verbose cwd /home/andy/projects/node.js/how-to-npm
46 error Linux 4.8.13-200.fc24.x86_64
47 error argv "/usr/bin/node" "/usr/bin/npm" "i"
48 error node v7.3.0
49 error npm  v4.0.5
50 error path /home/andy/projects/node.js/how-to-npm/node_modules/.staging
51 error code EACCES
52 error errno -13
53 error syscall mkdir
54 error Error: EACCES: permission denied, mkdir '/home/andy/projects/node.js/how-to-npm/node_modules/.staging'
54 error  { Error: EACCES: permission denied, mkdir '/home/andy/projects/node.js/how-to-npm/node_modules/.staging'
54 error   errno: -13,
54 error   code: 'EACCES',
54 error   syscall: 'mkdir',
54 error   path: '/home/andy/projects/node.js/how-to-npm/node_modules/.staging' }
55 error Please try running this command again as root/Administrator.
56 verbose exit [ -13, true ]

Tried manually creating .staging directory with sudo, but script then fails on rmdir. When running script with sudo, the following is output:

andy@fordprefect$ how-to-npm>>sudo how-to-npm verify
ERROR: No adventure is currently selected. Select an adventure from the menu.
the-octagon commented 7 years ago

OK, so I had been in the habit of using npm with sudo, and as a result, root was the owner of node_modules, thus the permissions issue. fix ended up being:

andy@fordprefect$ how-to-npm>>sudo rm -rf node_modules; npm install @linclark/pkg --save
watilde commented 7 years ago

Wow great that you could resolve it by yourself. Thanks for reporting it anyway :)