繁体   English   中英

创建新的Angle 7项目时出现的问题

[英]Issues when creating new angular 7 project

使用angular cli创建新项目时出错。 尝试过npm clear cache --force并手动删除了npm cache文件夹。 他们都没有工作。

无需代理即可连接互联网

ng new testapp--路由

> node-sass@4.11.0 install C:\Users\user\testapp\node_modules\node-sass
> node scripts/install.js

Downloading binary from https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node
Cannot download "https://github.com/sass/node-sass/releases/download/v4.11.0/win32-x64-72_binding.node":

HTTP error 404 Not Found

Hint: If github.com is not accessible in your location
      try setting a proxy via HTTP_PROXY, e.g.

      export HTTP_PROXY=http://example.com:1234

or configure npm proxy via

      npm config set proxy http://example.com:8080

> node-sass@4.11.0 postinstall C:\Users\user\testapp\node_modules\node-sass
> node scripts/build.js

Building: C:\Program Files\nodejs\node.exe C:\Users\user\testapp\node_modules\node-gyp\bin\node-gyp.js rebuild --verbose --libsass_ext= --libsass_cflags= --libsass_ldflags= --libsass_library=
gyp info it worked if it ends with ok
gyp verb cli [
gyp verb cli   'C:\\Program Files\\nodejs\\node.exe',
gyp verb cli   'C:\\Users\\user\\testapp\\node_modules\\node-gyp\\bin\\node-gyp.js',
gyp verb cli   'rebuild',
gyp verb cli   '--verbose',
gyp verb cli   '--libsass_ext=',
gyp verb cli   '--libsass_cflags=',
gyp verb cli   '--libsass_ldflags=',
gyp verb cli   '--libsass_library='
gyp verb cli ]
gyp info using node-gyp@3.8.0
gyp info using node@12.0.0 | win32 | x64
gyp verb command rebuild []
gyp verb command clean []
gyp verb clean removing "build" directory
gyp verb command configure []
gyp verb check python checking for Python executable "python2" in the PATH
gyp verb `which` failed Error: not found: python2
gyp verb `which` failed     at getNotFoundError ```

只需将新项目创建为:ng new testapp,然后删除角度cli并清除缓存,请再次

npm install -g @angular/cli

并构建并运行您的项目。

有时由于全局安装了许多库,您会得到上述错误。 无需创建新项目。 请执行以下步骤

步骤1:尝试再次执行npm i 如果最后出现错误,请转到步骤2

步骤2:$ npm install -g node-sass

最后,最后检查:$ node-sass -v

然后根据需要再次执行步骤1(可选)。

一旦node-sass安装成功,您将不会再遇到此错误。

希望这会有所帮助

我遇到了几乎相同的问题。 我猜您正在选择SCSS作为样式表格式? 在编译错误结束之前,我比您走得更远,但无法正常工作。 我通过降级到节点版本11解决了我的问题。似乎node-sass 4.11不支持节点版本12。请参阅安装node-sass时出错

显示下载错误,因为没有这样的文件。 github上编写的最新版本是win32-x64-67_binding.node

我也认为您可能对Python有依赖性问题。 查看node-gyp配置-Windows ,并确保您具有所有依赖项。

希望这可以帮助!

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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