简体   繁体   English

Windows和Linux上的npm安装之间有区别吗

[英]Is there a difference between npm install on windows & linux

i think i have a short question. 我想我有一个简短的问题。

I can't find anything in the www. 我在www中找不到任何内容。 if i run npm install on a windows machine to install my dependencies. 如果我在Windows机器上运行npm install来安装我的依赖项。 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? 是否可以将node_module目录移动到linux机器上并运行我的nodejs脚本,还是在安装操作系统并选择其他安装路径之前进行npm检查?

greetings mok 问候莫

Yes, there can be differences, say, if you (or your dependencies) use native node.js addons, which are built eg by node-gyp and contain native binary code. 是的,如果您(或您的依赖项)使用本机的node.js插件(例如,由node-gyp构建且包含本机的二进制代码),则可能会有差异。 Also there can be OS/CPU - specific stuff in package.json . package.json还可以包含特定于OS / CPU的内容。

package.json description can be found here: https://docs.npmjs.com/files/package.json package.json描述可以在这里找到: https : //docs.npmjs.com/files/package.json

There shouldn't be a difference between the npm i command between linux and windows. linux和Windows之间的npm i命令之间应该没有区别。

You should also never try to move the node_modules file. 您也永远不要尝试移动node_modules文件。 Normally in your project when you run npm init you will have a package.json file. 通常在您的项目中,当您运行npm init ,将有一个package.json文件。 This package.json file holds all the dependencies and devdependencies. 这个package.json文件包含所有依赖项和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. 如果然后运行npm i将使用package.json文件中指定的所有相应依赖项创建新的node_modules。

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

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