node.js - nodejs项目换了环境后各种报错
天蓬老师
天蓬老师 2017-04-17 13:48:50
0
6
596

nodejs项目从一个mac换到另一个mac后各种报错

/Users/test/WebstormProjects/testtt/node_modules/node-readability/node_modules/jsdom/lib/jsdom.js:3
`jsdom 4.x onward only works on io.js or Node.js 4 or newer: https://github.co
^
[SyntaxError: Unexpected token ILLEGAL]
SyntaxError: Unexpected token ILLEGAL

at Module._compile (module.js:439:25)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/test/WebstormProjects/testtt/node_modules/node-readability/src/readability.js:1:75)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
at Module.load (module.js:356:32)
at Function.Module._load (module.js:312:12)
at Module.require (module.js:364:17)
at require (module.js:380:17)
at Object.<anonymous> (/Users/test/WebstormProjects/testtt/api/services/readabilityService.js:5:12)
at Module._compile (module.js:456:26)
at Object.Module._extensions..js (module.js:474:10)
天蓬老师
天蓬老师

欢迎选择我的课程,让我们一起见证您的进步~~

reply all(6)
伊谢尔伦

Because your node version is too low,
jsdom 4.x onward only works on io.js or Node.js 4 or newer

Peter_Zhu

Check the node version difference between your two macs. It seems that your node version is too low.

Peter_Zhu

Thanks for the invitation. As mentioned above, the version is low~just download the latest version~

Ty80

node -v checks node version

You can install node version management tools such as nvm or n on mac

洪涛

According to my understanding, this kind of node project not only needs to indicate the version of the dependent package, but also needs to indicate the version of other dependencies, such as the running environment version number and the build tool version number, operating system, database version, etc. , because the node changes too fast

洪涛

node version problem

Also develop a good habit. Every time you install a new dependent module during the project life cycle, npm install xxx --save
npm adds --save. The version information of the dependent module will be written to package.json.
In this way, every time you change the server deployment, you can directly cp the package file and execute npm install, and you can deploy it according to the information (restore) in package.json and rely on the running environment

Of course the most important thing is node version compatibility.

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template