[英]Yeoman angular app npm install error not working
I've searched far and wide for a solution to this but can't seem to find an answer. 我一直在寻找解决方案,但似乎找不到答案。 I've used Yeoman scaffolding many times before on my old Windows 8 PC but I can't get it working on my new Windows 8 PC.
我以前在旧的Windows 8 PC上使用过Yeoman脚手架很多次,但在新的Windows 8 PC上却无法使用它。
I'm trying to scaffold an angular app using Yeoman. 我正在尝试使用Yeoman搭建一个有角度的应用程序。 I did the following:
我做了以下事情:
> npm install --global npm
> npm install --global yo bower grunt-cli
> npm install --global generator-angular
> mkdir mytodo && cd mytodo
> npm --version && yo --version && bower --version && grunt --version
2.5.1
1.4.6
1.4.1
grunt-cli v0.1.13
grunt v0.4.5
> yo angular
It runs up to the point where it runs bower install & npm install then shows a whole heap of errors. 它运行到运行bower install&npm install的地步,然后显示一堆错误。 This is in the npm-debug.log file.
这在npm-debug.log文件中。
0 info it worked if it ends with ok
1 verbose cli [ 'C:\\Program Files\\nodejs\\\\node.exe',
1 verbose cli 'C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js',
1 verbose cli 'install' ]
2 info using npm@2.5.1
3 info using node@v0.12.1
4 verbose node symlink C:\Program Files\nodejs\\node.exe
5 verbose config Skipping project config: C:\Users\melon/.npmrc. (matches userconfig)
6 error install Couldn't read dependencies
7 verbose stack Error: ENOENT, open 'C:\Users\melon\package.json'
7 verbose stack at Error (native)
8 verbose cwd C:\Users\melon
9 error Windows_NT 6.2.9200
10 error argv "C:\\Program Files\\nodejs\\\\node.exe" "C:\\Program Files\\nodejs\\node_modules\\npm\\bin\\npm-cli.js" "install"
11 error node v0.12.1
12 error npm v2.5.1
13 error path C:\Users\melon\package.json
14 error code ENOPACKAGEJSON
15 error errno -4058
16 error package.json ENOENT, open 'C:\Users\melon\package.json'
16 error package.json This is most likely not a problem with npm itself.
16 error package.json npm can't find a package.json file in your current directory.
17 verbose exit [ -4058, true ]
What I find interesting in the errors is that it is referring to "C:\\Users\\melon\\package.json". 我在错误中发现的有趣之处在于,它引用的是“ C:\\ Users \\ melon \\ package.json”。 Shouldn't it be looking in the project folder for package.json (which is c:\\projects\\mytodo)?
它是否不应该在项目文件夹中寻找package.json(即c:\\ projects \\ mytodo)?
Another weird thing is that it is putting a folder called node_modules inside C:\\Users\\melon\\node_modules. 另一个奇怪的事情是,它在C:\\ Users \\ melon \\ node_modules中放置了一个名为node_modules的文件夹。 This folder contains grunt, grunt-karma, jasmine-core, karma and karma-jasmine.
该文件夹包含grunt,grunt-karma,茉莉核,karma和karma-茉莉。 I already have the node_modules folder in C:\\Users\\melon\\AppData\\Roaming\\npm\\node_modules\\
我已经在C:\\ Users \\ melon \\ AppData \\ Roaming \\ npm \\ node_modules \\中拥有了node_modules文件夹
If I run the following manually, it installs successfully. 如果我手动运行以下命令,则说明安装成功。
> bower install
If I run the following manually, it fails. 如果我手动运行以下命令,它将失败。
> npm install
gifsicle@2.0.1 postinstall C:\Projects\mytodo\node_modules\grunt-contrib-imagemin\node_modules\imagemin\node_modules\imagemin-gifsicle\node_modules\gifsicle
> node lib/install.js
module.js:338
throw err;
^
Error: Cannot find module 'C:\Users\melon\lib\install.js'
at Function.Module._resolveFilename (module.js:336:15)
at Function.Module._load (module.js:278:25)
at Function.Module.runMain (module.js:501:10)
at startup (node.js:129:16)
at node.js:814:3
...........
Here is some relevant PATH details: 以下是一些相关的PATH详细信息:
PATH=C:\Program Files\nodejs\;C:\Program Files (x86)\Git\cmd;C:\Ruby193\bin;C:\ant\bin;C:\Users\melon\AppData\Roaming\npm
I hope this is enough information for someone to show me where I have gone wrong. 我希望这是足够的信息,以便有人告诉我我哪里出了问题。 Thanks in advance.
提前致谢。
Since I can not comment yet (need 50 rep.), I'm posting this as an answer. 由于我目前还不能发表评论(需要50个代表),因此我将其发布为答案。
Have you already tried another generator (eg webapp)? 您是否已经尝试过其他生成器(例如webapp)?
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.