Is there a difference between npm install on windows & linux

自古美人都是妖i 提交于 2020-05-29 06:15:47

问题


i think i have a short question.

I can't find anything in the www. if i run npm install on a windows machine to install my dependencies. is it possible to move the node_module directory to a linux machine and run my nodejs script, or is npm checking before installing my os and choose other install path's?

greetings mok


回答1:


Yes, there can be differences, say, if you (or your dependencies) use native node.js addons, which are built e.g. by node-gyp and contain native binary code. Also there can be OS/CPU - specific stuff in package.json.

package.json description can be found here: https://docs.npmjs.com/files/package.json




回答2:


There shouldn't be a difference between the npm i command between linux and windows.

You should also never try to move the node_modules file. Normally in your project when you run npm init you will have a package.json file. This package.json file holds all the dependencies and devdependencies. If you then run npm i a new node_modules will be created with all the corresponding dependencies specified in the package.json file.



来源:https://stackoverflow.com/questions/51724978/is-there-a-difference-between-npm-install-on-windows-linux

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!