简体   繁体   中英

npm run watch doesn't run: no such file or directory, open '/Users/usr/package.json'

I believe this might be happening because I used brew to install npm; I think I might have two different versions. Here is the error:

npm run watch
npm ERR! Darwin 14.5.0
npm ERR! argv "/usr/local/Cellar/node/5.4.1_1/bin/node" "/usr/local/bin/npm" "run" "watch"
npm ERR! node v5.4.1
npm ERR! npm  v3.5.3
npm ERR! path /Users/Nicolas/package.json
npm ERR! code ENOENT
npm ERR! errno -2
npm ERR! syscall open

npm ERR! enoent ENOENT: no such file or directory, open '/Users/Nicolas/package.json'
npm ERR! enoent ENOENT: no such file or directory, open '/Users/Nicolas/package.json'
npm ERR! enoent This is most likely not a problem with npm itself
npm ERR! enoent and is related to npm not being able to find a file.
npm ERR! enoent

npm ERR! Please include the following file with any support request:
npm ERR!     /Users/Nicolas/Code/wordpress/wp-content/themes/IMFA-theme/npm-debug.log

I have tried the following:

  • brew doctor (gives a lot of warnings and doesn't seem to change anything)
  • brew unlink and re-link (doesn't seem to do anything)

For what it's worth, I uninstalled and re-installed brew recently, and I know there are some unlinked kegs; I see this when I run brew doctor, but I don't know how to resolve it.

Other npm commands still seem to work, like npm install. However, npm run watch, in a directory where I want to compile SCSS, is giving me the error above. Any help is appreciated

I met the same problem npm err no such file or directory, open '/Users/usr/package.json' and I got the solution. to solve the problem,you need to init your environment,like $ xxx init ,then use npm install to install the dependences.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM