0
我相信这可能是因为我用brew来安装npm;我想我可能有两个不同的版本。以下是错误:npm run watch不运行:没有这样的文件或目录,打开'/Users/usr/package.json'
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
我曾尝试以下:
- 酿造医生(给出了大量的警告似乎并没有改变任何东西)
- 酝酿取消链接和重新链接(似乎没有做任何事情)
为什么它的价值,我最近卸载和重新安装brew,我知道有一些没有链接的桶;我运行酿造医生时看到了这一点,但我不知道如何解决。
其他npm命令似乎仍然有效,如npm install。但是,在我想编译SCSS的目录中,npm run watch正在给我上面的错误。任何帮助表示赞赏
in your package.json file“scripts”的值是什么:{“watch”:“?” } – chriskelly
对我来说,就像你在错误的文件夹中运行npm,你在你的home文件夹中运行它通常不是项目根目录所在的位置。至少npm不会在那里找到一个package.json文件。确保您位于正确的目录中,然后重试。 – grimurd
如果我已经cd到项目文件夹并使用npm run watch,我仍然会得到上述错误。无论我在哪里尝试执行npm,我似乎都能得到它 –