Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

增加cross-env,解决在windows 10 环境下出现的问题 #9

Merged
merged 1 commit into from
Dec 30, 2019

Conversation

teamlet
Copy link
Contributor

@teamlet teamlet commented Dec 28, 2019

在windows 10 环境下运行出错,错误信息和修改步骤如下:

一、执行npm install 出现错误,错误信息如下:

--------------------- 错误信息开始 -------------------------------->>>

npm install
npm WARN sass-loader@5.0.1 requires a peer of webpack@^2.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN webpack-dev-middleware@1.12.2 requires a peer of webpack@^1.0.0 || ^2.0.0 || ^3.0.0 but none is installed. You must install peer dependencies yourself.
npm WARN optional SKIPPING OPTIONAL DEPENDENCY: fsevents@1.2.9 (node_modules\fsevents):
npm WARN notsup SKIPPING OPTIONAL DEPENDENCY: Unsupported platform for fsevents@1.2.9: wanted {"os":"darwin","arch":"any"} (current: {"os":"win32","arch":"x64"})

audited 14774 packages in 5.586s
found 1 moderate severity vulnerability
run npm audit fix to fix them, or npm audit for details
----------------------- 错误信息结束 ---------------------------------------------------------------<<<

  • 修复方法:

1、 按照提示执行 npm audit fix,
2、 然后再执行 npm install 问题解决。

二、执行 npm start 出现错误:

----------------------- 错误信息开始 ------------------------------------------>>>
'NODE_ENV' 不是内部或外部命令,也不是可运行的程序。
-------------------------错误信息结束 --------------------------------------------<<<

  • 修复方法

1、 首先安装cross-env,执行 npm install cross-env --save-dev ;
2、 然后执行 npm install;
3、 修改 package.json 文件,在start 前面添加 cross-env ;
4、最后,执行 npm start

正常启动!

cross-env的强大之处就在于不同系统下可使用唯一的指令,无需担心跨平台问题。

…stall 问题解决。

2、执行 npm start 出现错误:'NODE_ENV' 不是内部或外部命令,也不是可运行的程序。首先安装 npm install cross-env --save-dev ;然后执行 npm install
; 修改 package.json 文件,在start 前面添加 cross-env ;最后,执行 npm start,正常启动!
@ymyqwe
Copy link
Owner

ymyqwe commented Dec 30, 2019

多谢,由于好久没用windows了,也懒得装虚拟机,所以没有测试win环境下的运行

@ymyqwe ymyqwe merged commit cabed47 into ymyqwe:master Dec 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants